function display_listings($atts = array(), $echo_this = false)
{
    global $wpdb;
    extract(shortcode_atts(array('type' => $wpdb->escape($_POST["type"]), 'l_type' => $wpdb->escape($_REQUEST["l_type"]), 'ex_type' => $wpdb->escape($_REQUEST["ex_type"]), 'l_featured' => $wpdb->escape($_POST["l_featured"]), 'order_dir' => $wpdb->escape($_POST["order_dir"]), 'order_by' => $wpdb->escape($_POST["order_by"]), 'l_ids' => $wpdb->escape($_REQUEST["l_ids"]), 'limit' => $wpdb->escape($_REQUEST["limit"]), 'show_paging' => $wpdb->escape($_POST["show_paging"])), $atts));
    $data = get_option("bepro_listings");
    $num_results = empty($limit) || !is_numeric($limit) ? $data["num_listings"] : $limit;
    $type = empty($type) ? 1 : $type;
    //find which types are allowed
    if (!empty($ex_type) && bl_check_is_valid_cat($ex_type)) {
        $raw_l_types = get_terms(array('bepro_listing_types'), array('exclude' => explode(",", $ex_type)));
        foreach ($raw_l_types as $raw_l_type) {
            $l_type[] = $raw_l_type->term_id;
        }
        if (!empty($l_type) && is_array($l_type)) {
            $l_type = implode(",", $l_type);
        }
    }
    //make presumption to randomize featured listings
    if (empty($order_by) && !empty($l_featured)) {
        $order_by = 2;
    }
    if (empty($order_dir)) {
        $order_dir = 1;
    }
    $findings = process_listings_results($show_paging, $num_results, $l_type, $l_ids, $order_by, $order_dir);
    $raw_results = $findings[0];
    //Create the GUI layout for the listings
    if (empty($raw_results) || is_null($raw_results)) {
        $results = "<p>your criteria returned no results.</p>";
    } else {
        //item listing template
        $list_templates = isset($data['bepro_listings_list_template_' . $type]) ? $data['bepro_listings_list_template_' . $type] : $data['bepro_listings_list_template_1'];
        foreach ($list_templates as $key => $val) {
            if ($key == "style") {
                $results .= "<link href='" . $val . "' rel='stylesheet' />";
            } else {
                if ($key == "template_file") {
                    $results .= "";
                } else {
                    add_action($key, $val);
                }
            }
        }
        $previous = array();
        $check = apply_filters("bl_start_bepro_listing_template", $type);
        $results .= @(is_numeric($check) || $check == $type) ? "" : $check;
        //loop over listing template file
        foreach ($raw_results as $result) {
            $check = apply_filters("bl_before_bepro_listing_template", $type, $result, $previous);
            $results .= @(is_numeric($check) || $check == $type) ? "" : $check;
            $result->featured = is_numeric($l_featured);
            $results .= basic_listing_layout($result, $list_templates["template_file"]);
            $check = apply_filters("bl_after_bepro_listing_template", $type, $result, $previous);
            $results .= @(is_numeric($check) || $check == $type) ? "" : $check;
            $previous = $result;
        }
        $check = apply_filters("bl_end_bepro_listing_template", $type);
        $results .= @(is_numeric($check) || $check == $type) ? "" : $check;
        foreach ($list_templates as $key => $val) {
            remove_action($key, $val);
        }
    }
    //show paging if not featured listings and if its selected as an option
    if ($show_paging == 1 && empty($l_featured)) {
        $pages = 0;
        $pages = $findings[1];
        $counter = 1;
        $paging = "<div style='clear:both'><br /></div><div class='paging'>Pages: ";
        while ($pages != 0) {
            $selected = !empty($_REQUEST["lpage"]) && $counter == $_REQUEST["lpage"] || empty($_REQUEST["lpage"]) && $counter == 1 ? $selected = "selected" : "";
            $paging .= "<a href='?lpage=" . $counter . "' class='{$selected}'>" . $counter . "</a>";
            $pages--;
            $counter++;
        }
        $paging .= "</div>";
        if ($counter > 1) {
            $results .= $paging;
        }
        // if no pages then dont show this
        $show_paging = "<div id='bl_show_paging' class='bl_shortcode_selected'>{$show_paging}</div>";
    } else {
        if (empty($l_featured)) {
            $show_paging = "<div id='bl_show_paging' class='bl_shortcode_selected'>0</div>";
        }
    }
    if (!empty($l_featured)) {
        $l_featured_id = "_featured";
    } else {
        $show_bl_type = "<div id='bl_type' class='bl_shortcode_selected'>{$type}</div>";
        $hidden_limit_text = "<div id='bl_limit' class='bl_shortcode_selected'>{$limit}</div>";
    }
    $results = "<div id='shortcode_list{$l_featured_id}'>" . $results . "</div>";
    $results .= "{$hidden_limit_text} {$show_bl_type} {$show_paging}";
    if ($echo_this) {
        echo $results;
    } else {
        return $results;
    }
}
function bepro_listings_options()
{
    $data = get_option("bepro_listings");
    if (!empty($_POST["update_options"])) {
        //general
        $data["show_cost"] = $_POST["show_cost"];
        $data["show_con"] = $_POST["show_con"];
        $data["show_geo"] = $_POST["show_geo"];
        $data["num_images"] = $_POST["num_images"];
        $data["cat_heading"] = $_POST["cat_heading"];
        $data["cat_empty"] = $_POST["cat_empty"];
        $data["cat_singular"] = $_POST["cat_singular"];
        //forms
        $data["validate_form"] = $_POST["validate_form"];
        $data["default_user_id"] = $_POST["default_user_id"];
        $data["default_status"] = $_POST["default_status"];
        $data["success_message"] = $_POST["success_message"];
        $data["fail_message"] = $_POST["fail_message"];
        //check cat exclude
        $data["bepro_listings_cat_exclude"] = bl_check_is_valid_cat($_POST["bepro_listings_cat_exclude"]) ? $_POST["bepro_listings_cat_exclude"] : "";
        //check cat required
        $data["bepro_listings_cat_required"] = bl_check_is_valid_cat($_POST["bepro_listings_cat_required"]) ? $_POST["bepro_listings_cat_required"] : "";
        //search listings
        $data["default_image"] = $_POST["default_image"];
        $data["link_new_page"] = $_POST["link_new_page"];
        $data["ajax_on"] = $_POST["ajax_on"];
        $data["num_listings"] = $_POST["num_listings"];
        $data["distance"] = $_POST["distance"];
        $data["details_link"] = $_POST["details_link"];
        $data["show_web_link"] = $_POST["show_web_link"];
        $data["show_date"] = $_POST["show_date"];
        $data["currency_sign"] = $_POST["currency_sign"];
        //Page/post
        $data["gallery_size"] = $_POST["gallery_size"];
        $data["gallery_cols"] = $_POST["gallery_cols"];
        $data["show_details"] = $_POST["show_details"];
        $data["add_detail_links"] = $_POST["add_detail_links"];
        $data["show_content"] = $_POST["show_content"];
        //map
        $data["map_query_type"] = $_POST["map_query_type"];
        //buddypress
        $data["buddypress"] = $_POST["buddypress"];
        //Support
        $data["footer_link"] = $_POST["footer_link"];
        update_option("bepro_listings", $data);
        if (isset($_FILES["csv_upload"]) && !empty($_FILES["csv_upload"]["size"])) {
            $delimiter = $_POST["csv_upload_delimiter"];
            $file_path = $_FILES["csv_upload"]["tmp_name"];
            $file = fopen($file_path, 'r');
            $csv_titles = array();
            $counter = 0;
            while (($results = fgetcsv($file, 1500, $delimiter)) !== false) {
                if ($counter > 0) {
                    $_POST = "";
                    foreach ($results as $key => $result) {
                        $_POST[$csv_titles[$key]] = $result;
                    }
                    if (!empty($csv_titles[0])) {
                        $_POST["save_bepro_listing"] = 1;
                        $post_id = bepro_listings_save(false, true);
                        if (!empty($_POST["photo"])) {
                            $remote_url = addslashes(strip_tags($_POST["photo"]));
                            bl_attach_remote_file($post_id, $remote_url);
                        }
                    }
                } else {
                    $csv_titles = array_values($results);
                }
                $counter++;
            }
            fclose($file);
        }
    }
    ?>
		<h1>BePro Listings Options</h1>
		<div class="wrap bepro_listings_admin_form">
			<form class="bepro_listings" method="post" enctype="multipart/form-data">
				<input type="hidden" name="update_options" value="1" />
				<div id="bepro_listings_tabs">
					<ul>
						<li><a href="#tabs-1">General</a></li>
						<li><a href="#tabs-2">Forms</a></li>
						<li><a href="#tabs-3">Search/Listings</a></li>
						<li><a href="#tabs-4">Page/Post</a></li>
						<li><a href="#tabs-5">Map</a></li>
						<li><a href="#tabs-6">Buddypress</a></li>
						<li><a href="#tabs-7">CSV Upload</a></li>
						<li><a href="#tabs-8">Support</a></li>
					</ul>
				
					<div id="tabs-1">
						<span class="form_label"><?php 
    _e("Show Cost", "bepro-listings");
    ?>
</span><input type="checkbox" name="show_cost" <?php 
    echo $data["show_cost"] == (1 || "on") ? 'checked="checked"' : "";
    ?>
><br />
						<span class="form_label"><?php 
    _e("Show Contact", "bepro-listings");
    ?>
</span><input type="checkbox" name="show_con" <?php 
    echo $data["show_con"] == (1 || "on") ? 'checked="checked"' : "";
    ?>
><br />
						<span class="form_label"><?php 
    _e("Show Geography", "bepro-listings");
    ?>
</span><input type="checkbox" name="show_geo" <?php 
    echo $data["show_geo"] == (1 || "on") ? 'checked="checked"' : "";
    ?>
><br />
						<span class="form_label"><?php 
    _e("# Of Uploads", "bepro-listings");
    ?>
</span><select name="num_images"><br />
							<option value="1" <?php 
    echo $data["num_images"] == 1 ? 'selected="selected"' : "";
    ?>
>1</option>
							<option value="2" <?php 
    echo $data["num_images"] == 2 ? 'selected="selected"' : "";
    ?>
>2</option>
							<option value="3" <?php 
    echo $data["num_images"] == 3 ? 'selected="selected"' : "";
    ?>
>3</option>
							<option value="4" <?php 
    echo $data["num_images"] == 4 ? 'selected="selected"' : "";
    ?>
>4</option>
							<option value="5" <?php 
    echo $data["num_images"] == 5 ? 'selected="selected"' : "";
    ?>
>5</option>
							<option value="6" <?php 
    echo $data["num_images"] == 6 ? 'selected="selected"' : "";
    ?>
>6</option>
							<option value="7" <?php 
    echo $data["num_images"] == 7 ? 'selected="selected"' : "";
    ?>
>7</option>
							<option value="8" <?php 
    echo $data["num_images"] == 8 ? 'selected="selected"' : "";
    ?>
>8</option>
							<option value="9" <?php 
    echo $data["num_images"] == 9 ? 'selected="selected"' : "";
    ?>
>9</option>
							<option value="0" <?php 
    echo $data["num_images"] == 0 ? 'selected="selected"' : "";
    ?>
>None</option>
						</select><br />
						<span class="form_label"><?php 
    _e("Category Heading", "bepro-listings");
    ?>
</span><input type="input" name="cat_heading" value="<?php 
    echo $data["cat_heading"];
    ?>
"><br />
						<span class="form_label"><?php 
    _e("Category Empty", "bepro-listings");
    ?>
</span><input type="input" name="cat_empty" value="<?php 
    echo $data["cat_empty"];
    ?>
"><br />
						<span class="form_label"><?php 
    _e("Category Singular", "bepro-listings");
    ?>
</span><input type="input" name="cat_singular" value="<?php 
    echo $data["cat_singular"];
    ?>
"><br />
					</div>
					<div id="tabs-2">
						<span class="form_label"><?php 
    _e("Validate Form", "bepro-listings");
    ?>
</span><input type="checkbox" name="validate_form" <?php 
    echo $data["validate_form"] == (1 || "on") ? 'checked="checked"' : "";
    ?>
><br />
						<span class="form_label"><?php 
    _e("Default User Id", "bepro-listings");
    ?>
</span><input type="text" name="default_user_id" value="<?php 
    echo $data["default_user_id"];
    ?>
"><br />
						<span class="form_label"><?php 
    _e("Default Status", "bepro-listings");
    ?>
</span><select name="default_status">
							<option value="pending" <?php 
    echo $data["default_status"] == "pending" ? 'selected="selected"' : "";
    ?>
>Pending</option>
							<option value="publish" <?php 
    echo $data["default_status"] == "publish" ? 'selected="selected"' : "";
    ?>
>Published</option>
						</select></br>
						<span class="form_label"><?php 
    _e("Success Message", "bepro-listings");
    ?>
</span><textarea name="success_message"><?php 
    echo $data["success_message"];
    ?>
</textarea><br />
						<span class="form_label"><?php 
    _e("Fail Message", "bepro-listings");
    ?>
</span><textarea name="fail_message"><?php 
    echo $data["fail_message"];
    ?>
</textarea><br />
						<span class="form_label"><?php 
    _e("Required Categories", "bepro-listings");
    ?>
</span><input type="text" name="bepro_listings_cat_required" value="<?php 
    echo $data["bepro_listings_cat_required"];
    ?>
" /></br>
						<span class="form_label"><?php 
    _e("Exclude Categories", "bepro-listings");
    ?>
</span><input type="text" name="bepro_listings_cat_exclude" value="<?php 
    echo $data["bepro_listings_cat_exclude"];
    ?>
" /></br>
					</div>
					<div id="tabs-3">
						<span class="form_label"><?php 
    _e("Default Listing Image", "bepro-listings");
    ?>
</span><input type="text" name="default_image" value="<?php 
    echo $data["default_image"];
    ?>
" /></br>
						<span class="form_label"><?php 
    _e("How Links Open", "bepro-listings");
    ?>
</span><select name="link_new_page">
							<option value="1" <?php 
    echo $data["link_new_page"] == 1 ? 'selected="selected"' : "";
    ?>
>Go To Page</option>
							<option value="2" <?php 
    echo $data["link_new_page"] == 2 ? 'selected="selected"' : "";
    ?>
>New Tab</option>
							<option value="3" <?php 
    echo $data["link_new_page"] == 3 ? 'selected="selected"' : "";
    ?>
>Ajax Page</option>
							<option value="4" <?php 
    echo $data["link_new_page"] == 4 ? 'selected="selected"' : "";
    ?>
>Hide Internal</option>
						</select><br />
						<span class="form_label"><?php 
    _e("Ajax On?", "bepro-listings");
    ?>
</span><input type="checkbox" name="ajax_on" <?php 
    echo $data["ajax_on"] == (1 || "on") ? 'checked="checked"' : "";
    ?>
><br />
						<span class="form_label"><?php 
    _e("Default # Listings", "bepro-listings");
    ?>
</span><select name="num_listings">
							<option value="1" <?php 
    echo $data["num_listings"] == 1 ? 'selected="selected"' : "";
    ?>
>1</option>
							<option value="3" <?php 
    echo $data["num_listings"] == 3 ? 'selected="selected"' : "";
    ?>
>3</option>
							<option value="5" <?php 
    echo $data["num_listings"] == 5 ? 'selected="selected"' : "";
    ?>
>5</option>
							<option value="8" <?php 
    echo $data["num_listings"] == 8 ? 'selected="selected"' : "";
    ?>
>8</option>
							<option value="10" <?php 
    echo $data["num_listings"] == 10 ? 'selected="selected"' : "";
    ?>
>10</option>
							<option value="12" <?php 
    echo $data["num_listings"] == 12 ? 'selected="selected"' : "";
    ?>
>12</option>
							<option value="16" <?php 
    echo $data["num_listings"] == 16 ? 'selected="selected"' : "";
    ?>
>16</option>
							<option value="20" <?php 
    echo $data["num_listings"] == 20 ? 'selected="selected"' : "";
    ?>
>20</option>
							<option value="50" <?php 
    echo $data["num_listings"] == 50 ? 'selected="selected"' : "";
    ?>
>50</option>
						</select></br>
						<span class="form_label"><?php 
    _e("Default Search Distance (Mi)", "bepro-listings");
    ?>
</span><select name="distance">
							<option value="10" <?php 
    echo $data["distance"] == 10 ? 'selected="selected"' : "";
    ?>
>10</option>
							<option value="50" <?php 
    echo $data["distance"] == 50 ? 'selected="selected"' : "";
    ?>
>50</option>
							<option value="150" <?php 
    echo $data["distance"] == 150 ? 'selected="selected"' : "";
    ?>
>150</option>
							<option value="250" <?php 
    echo $data["distance"] == 250 ? 'selected="selected"' : "";
    ?>
>250</option>
							<option value="500" <?php 
    echo $data["distance"] == 500 ? 'selected="selected"' : "";
    ?>
>500</option>
							<option value="1000" <?php 
    echo $data["distance"] == 1000 ? 'selected="selected"' : "";
    ?>
>1000</option>
						</select>
						<span style="clear:both;display: block;"><br /></span>
						<span class="form_label"><?php 
    _e("Details Link Text", "bepro-listings");
    ?>
</span><input type="text" name="details_link" value="<?php 
    echo $data["details_link"];
    ?>
" /></br>
						<span class="form_label"><?php 
    _e("Show Website Link?", "bepro-listings");
    ?>
</span><input type="checkbox" name="show_web_link" <?php 
    echo $data["show_web_link"] == 1 || $data["show_web_link"] == "on" ? 'checked="checked"' : "";
    ?>
 value="1"><br />
						<span class="form_label"><?php 
    _e("Currency Sign?", "bepro-listings");
    ?>
</span><input type="text" name="currency_sign" value="<?php 
    echo $data["currency_sign"];
    ?>
" /></br>
						<span class="form_label"><?php 
    _e("Show Date filter?", "bepro-listings");
    ?>
</span><input type="checkbox" name="show_date" <?php 
    echo $data["show_date"] == 1 ? 'checked="checked"' : "";
    ?>
 value="1"><br />
						<span style="clear:both;display: block;"><br /></span>
					</div>
					<div id="tabs-4">
						<span class="form_label"><?php 
    _e("Gallery Size", "bepro-listings");
    ?>
</span><select name="gallery_size">
							<option value="thumbnail" <?php 
    echo $data["gallery_size"] == "thumbnail" ? 'selected="selected"' : "";
    ?>
>thumbnail</option>
							<option value="medium" <?php 
    echo $data["gallery_size"] == "medium" ? 'selected="selected"' : "";
    ?>
>medium</option>
							<option value="large" <?php 
    echo $data["gallery_size"] == "large" ? 'selected="selected"' : "";
    ?>
>large</option>
							<option value="full" <?php 
    echo $data["gallery_size"] == "full" ? 'selected="selected"' : "";
    ?>
>full</option>
						</select><br />
						<span class="form_label"><?php 
    _e("#Gallery Columns", "bepro-listings");
    ?>
</span><select name="gallery_cols">
							<option value="3" <?php 
    echo $data["gallery_cols"] == 3 ? 'selected="selected"' : "";
    ?>
>3</option>
							<option value="5" <?php 
    echo $data["gallery_cols"] == 5 ? 'selected="selected"' : "";
    ?>
>5</option>
							<option value="8" <?php 
    echo $data["gallery_cols"] == 8 ? 'selected="selected"' : "";
    ?>
>8</option>
						</select><br />
						<span class="form_label"><?php 
    _e("Show Details", "bepro-listings");
    ?>
</span><input type="checkbox" name="show_details" <?php 
    echo $data["show_details"] == (1 || "on") ? 'checked="checked"' : "";
    ?>
><br />
						<span class="form_label"><?php 
    _e("Links on Details", "bepro-listings");
    ?>
</span><input type="checkbox" name="add_detail_links" <?php 
    echo $data["add_detail_links"] == (1 || "on") ? 'checked="checked"' : "";
    ?>
><br />
						<span class="form_label"><?php 
    _e("Show Content", "bepro-listings");
    ?>
</span><input type="checkbox" name="show_content" <?php 
    echo $data["show_content"] == (1 || "on") ? 'checked="checked"' : "";
    ?>
>
					</div>
					<div id="tabs-5">
						<span class="form_label"><?php 
    _e("Query Type", "bepro-listings");
    ?>
</span><select name="map_query_type">
							<option value="curl" <?php 
    echo $data["map_query_type"] == "curl" ? 'selected="selected"' : "";
    ?>
>Curl</option>
							<option value="file_get_contents" <?php 
    echo $data["map_query_type"] == "file_get_contents" ? 'selected="selected"' : "";
    ?>
>file_get_contents</option>
						</select>	
					</div>
					<div id="tabs-6">
						<span class="form_label"><?php 
    _e("Buddypress", "bepro-listings");
    ?>
</span><input type="checkbox" name="buddypress" <?php 
    echo $data["buddypress"] == (1 || "on") ? 'checked="checked"' : "";
    ?>
>
					</div>
					<div id="tabs-7">
						<p>CSV upload documenation avaialble <a href="http://beprosoftware.com/products/bepro-listings" target="_blank">here</a></p>
						<span class="form_label"><?php 
    _e("CSV File", "bepro-listings");
    ?>
</span><input type="file" name="csv_upload" value=""><br />
						<span class="form_label"><?php 
    _e("Delimiter", "bepro-listings");
    ?>
</span><select name="csv_upload_delimiter">
							<option value=";">;</option>
							<option value=",">,</option>
							<option value="#*">#*</option>
						</select>
					</div>
					<div id="tabs-8">
						<a href="http://beprosoftware.com"><img src="<?php 
    echo BEPRO_LISTINGS_PLUGIN_PATH . "/images/bepro_software_logo.png";
    ?>
"></a><br />
						<iframe width="560" height="315" src="//www.youtube.com/embed/D5YpZX0go88" frameborder="0" allowfullscreen></iframe>
						<p><b>THANK YOU</b> for your interest and support of this plugin. Our BePro Software Team is dedicated to providing you with the tools needed for great websites. You can get involved in any of the following ways:</p>
						<h2>Support For You</h2>
						<ul style="border:1px solid; padding:10px">
							<li>Support Forum - Join our <a href="http://beprosoftware.com/forums" target="_blank">forums</a> for any support questions</li>
							<li>Documentation - Instructions, videos, shortcodes, and more on <a href="http://beprosoftware.com/products/bepro-listings/">this dedicated page</a></li>
							<li>Contact Us - Send us an email via our <a href="http://www.beprosoftware.com/contact-us/">Contact Us</a> Page</li>
							<li>Upgrades - View our list of <a href="http://www.beprosoftware.com/products/" target="_blank">wordpress plugins and themes</a></li>
							<li>Services - We offer <a href="http://www.beprosoftware.com/services/" target="_blank">Various services</a> including support starting at $15/hr</li>
							<li>Social - Our <a href="https://twitter.com/BeProSoftware" target="_blank">Twitter Page</a></li>
							<li>Youtube - Our <a href="http://www.youtube.com/playlist?list=PLMzIqO2N1YpjMx4QfiCjwFsxxfHVy1goG" target="_blank">Youtube Playlist</a> managed by <a href="http://www.adcoordinates.com" target="_blank">Ad Coordinates</a></li>
						</ul>
						<h2>Support For The Plugin</h2>
						<ul style="border:1px solid; padding:10px">		
							<li><a href="http://wordpress.org/support/view/plugin-reviews/bepro-listings" target="_blank"><span style="color:green;font-weight:bold;font-size:18px;text-decoration:underline">Rate Us</span></a> - Give this plugin a <a href="http://wordpress.org/support/view/plugin-reviews/bepro-listings" target="_blank"><span style="color:green;font-weight:bold;font-size:18px;text-decoration:underline">rating</span></a> on <a href="http://wordpress.org/support/view/plugin-reviews/bepro-listings" target="_blank">Wordpress.org</a>. This is the best way to support the plugin and encourage its growth</li>
							<li>Donations - We accept donations of any amount <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@beprosoftware.com&item_name=Donation+for+BePro+Listings">via paypal</a></li>
							<li><?php 
    _e("Our Link in your footer?", "bepro-listings");
    ?>
 - <input style="vertical-align:middle" type="checkbox" name="footer_link" value="1" <?php 
    echo $data["footer_link"] == ("on" || 1) ? 'checked="checked"' : "";
    ?>
></li>
						</ul>
						<p>NOTE: We can help with customizing this plugin to fit any of your needs. Simply <a href="http://www.beprosoftware.com/contact-us/" target="_blank">reach out</a>. You will receive a personalized responce from a senior member of our <b>BePro Software Team</b></p>
						<hr />
						<p><b>BePro Software&trade;</b> is a service owned and operated by <a href="http://beyondprograms.ca" target="_blank">Beyond Programs Ltd.</a> a Canadian company.</p>
					</div>
				</div>
				<span style="clear:both;display: block;"><br /></span>
				<input type="submit" name="submit" value="Update BePro Listings Options &raquo" />
			</form>
		</div>
		<div class="bepro_listings_loading_msg">
		<p>Jquery is loading... Please wait</p>
		</div>	
			<?php 
}
Ejemplo n.º 3
0
function permalink_save_options()
{
    $data = get_option("bepro_listings");
    if (isset($_POST["bl_permalink_option"])) {
        $data["permalink"] = $_POST["bl_permalink_option"];
        $data["cat_permalink"] = $_POST["bl_cat_permalink_option"];
        update_option("bepro_listings", $data);
    }
    //admin options menu save
    if (!empty($_POST["bpl_update_options"])) {
        //general
        $data["show_cost"] = $_POST["show_cost"];
        $data["show_con"] = $_POST["show_con"];
        $data["show_geo"] = $_POST["show_geo"];
        $data["show_imgs"] = $_POST["show_imgs"];
        $data["num_images"] = $_POST["num_images"];
        $data["cat_heading"] = $_POST["cat_heading"];
        $data["cat_empty"] = $_POST["cat_empty"];
        $data["cat_singular"] = $_POST["cat_singular"];
        //forms
        $data["validate_form"] = $_POST["validate_form"];
        $data["default_user_id"] = $_POST["default_user_id"];
        $data["use_tiny_mce"] = $_POST["use_tiny_mce"];
        $data["default_status"] = $_POST["default_status"];
        $data["success_message"] = $_POST["success_message"];
        $data["fail_message"] = $_POST["fail_message"];
        $data["form_cat_style"] = $_POST["form_cat_style"];
        //check cat exclude
        $data["bepro_listings_cat_exclude"] = bl_check_is_valid_cat($_POST["bepro_listings_cat_exclude"]) ? $_POST["bepro_listings_cat_exclude"] : "";
        //check cat required
        $data["bepro_listings_cat_required"] = bl_check_is_valid_cat($_POST["bepro_listings_cat_required"]) ? $_POST["bepro_listings_cat_required"] : "";
        //search listings
        $data["default_image"] = $_POST["default_image"];
        $data["link_new_page"] = $_POST["link_new_page"];
        $data["ajax_on"] = $_POST["ajax_on"];
        $data["num_listings"] = $_POST["num_listings"];
        $data["distance"] = $_POST["distance"];
        $data["dist_measurement"] = $_POST["dist_measurement"];
        $data["search_names"] = $_POST["search_names"];
        $data["title_length"] = is_numeric($_POST["title_length"]) ? $_POST["title_length"] : $data["title_length"];
        $data["desc_length"] = is_numeric($_POST["desc_length"]) ? $_POST["desc_length"] : $data["desc_length"];
        $data["details_link"] = $_POST["details_link"];
        $data["show_web_link"] = $_POST["show_web_link"];
        $data["show_date"] = $_POST["show_date"];
        $data["currency_sign"] = $_POST["currency_sign"];
        //Page/post
        $data["gallery_size"] = $_POST["gallery_size"];
        $data["gallery_cols"] = $_POST["gallery_cols"];
        $data["page_template"] = $_POST["page_template"];
        $data["show_details"] = $_POST["show_details"];
        $data["add_detail_links"] = $_POST["add_detail_links"];
        $data["protect_contact"] = $_POST["protect_contact"];
        $data["show_content"] = $_POST["show_content"];
        $data["show_comments"] = $_POST["show_comments"];
        $data["tabs_type"] = $_POST["tabs_type"];
        //map
        $data["map_query_type"] = $_POST["map_query_type"];
        $data["map_use_api"] = $_POST["map_use_api"];
        $data["map_zoom"] = $_POST["map_zoom"];
        //3rd party
        $data["buddypress"] = $_POST["buddypress"];
        //payment
        $data["require_payment"] = $_POST["require_payment"];
        $data["cat_fee_duration"] = $_POST["cat_fee_duration"];
        $fee_count = 1;
        $data["add_to_cart"] = $_POST["add_to_cart"];
        $data["publish_after_payment"] = $_POST["publish_after_payment"];
        //repair
        if (!empty($_POST["recreate_templates"]) && $_POST["recreate_templates"] == 2) {
            $data = create_result_listing_templates($data);
        }
        if (!empty($_POST["bepro_email_notifications"]) && $_POST["bepro_email_notifications"] == 2) {
            create_bepro_emails_for_bepro_listings();
        }
        //Support
        $data["footer_link"] = $_POST["footer_link"];
        update_option("bepro_listings", $data);
        if (isset($_FILES["csv_upload"]) && !empty($_FILES["csv_upload"]["size"])) {
            $delimiter = $_POST["csv_upload_delimiter"];
            $file_path = $_FILES["csv_upload"]["tmp_name"];
            $file = fopen($file_path, 'r');
            $csv_titles = array();
            $counter = 0;
            while (($results = fgetcsv($file, 1500, $delimiter)) !== false) {
                if ($counter > 0) {
                    $_POST = "";
                    foreach ($results as $key => $result) {
                        $_POST[$csv_titles[$key]] = $result;
                    }
                    if (!empty($csv_titles[0])) {
                        //check for multiple categories
                        $_POST["categories"] = !empty($_POST["categories"]) && !is_numeric($_POST["categories"]) && strpos($_POST["categories"], '|') !== false ? str_replace("|", ",", $_POST["categories"]) : $_POST["categories"];
                        $_POST["save_bepro_listing"] = 1;
                        $post_id = bepro_listings_save(false, true);
                        if (!empty($_POST["photo"])) {
                            //we only handle single photo uploads
                            if (stristr($_POST["photo"], ",")) {
                                $photos = explode(",", $_POST["photo"]);
                                foreach ($photos as $photo) {
                                    $remote_url = addslashes(strip_tags($_POST["photo"]));
                                    bl_attach_remote_file($post_id, $remote_url);
                                }
                            } else {
                                $remote_url = addslashes(strip_tags($_POST["photo"]));
                                bl_attach_remote_file($post_id, $remote_url);
                            }
                        }
                    }
                } else {
                    $csv_titles = array_values($results);
                }
                $counter++;
            }
            fclose($file);
        }
    }
    //end options menu save
}
Ejemplo n.º 4
0
    function searchform($atts = array(), $echo_this = false)
    {
        global $wpdb;
        extract(shortcode_atts(array('listing_page' => $wpdb->escape($_POST["listing_page"]), 'l_type' => $wpdb->escape($_POST["l_type"])), $atts));
        $data = get_option("bepro_listings");
        if (@$_REQUEST["l_type"] && is_numeric($_REQUEST["l_type"]) && bl_check_is_valid_cat($_REQUEST["l_type"])) {
            $l_type = bl_check_is_valid_cat($_REQUEST["l_type"]);
        }
        $return_text = '
			<div class="search_listings bl_frontend_search_section">
				<form method="post" name="searchform" id="listingsearchform" action="' . $listing_page . '">
					<input type="hidden" name="filter_search" value="1">
					<input type="hidden" name="l_type" value="' . $l_type . '">
					<input type="hidden" name="distance" value="' . $_POST["distance"] . '">
					<input type="hidden" name="min_date" value="' . $_POST["min_date"] . '">
					<input type="hidden" name="max_date" value="' . $_POST["max_date"] . '">
					<input type="hidden" name="listing_page" value="' . $listing_page . '">
					<input type="hidden" name="min_cost" value="' . $_POST["min_cost"] . '">
					<input type="hidden" name="max_cost" value="' . $_POST["max_cost"] . '">';
        if (is_numeric($data["show_geo"]) && $data["show_geo"] > 0) {
            $return_text .= '
					<span class="blsearchwhere">
						<span class="searchlabel">' . __("Where", "bepro-listings") . '</span>
						<input type="text" name="addr_search" value="' . $_POST["addr_search"] . '">
					</span>';
        }
        if (@$data["search_names"] != 4) {
            $return_text .= '
					<span class="blsearchname">
						<span class="searchlabel">' . __("Name", "bepro-listings") . '</span>
						<input type="text" name="name_search" id="name_search" value="' . $_POST["name_search"] . '">
					</span>';
        }
        $return_text .= '<span class="blsearchbuttons">
					<input type="submit" value="' . __("Search Listings", "bepro-listings") . '">
										<a class="clear_search" href="' . get_bloginfo("url") . "/" . $listing_page . '"><button>' . __("Clear Search", "bepro-listings") . '</button></a>
					</span>					
				</form>
			</div>
		';
        if ($echo_this) {
            echo $return_text;
        } else {
            return $return_text;
        }
    }