/** * Service runner * @author Howard <*****@*****.**> * @return void */ public function run() { $wpl_format = wpl_request::getVar('wpl_format'); if (trim($wpl_format) == '') { return; } /** add listing menu **/ if ($wpl_format == 'b:listing:ajax') { $wpl_function = wpl_request::getVar('wpl_function'); if ($wpl_function == 'save') { $table_name = wpl_request::getVar('table_name'); $table_column = wpl_request::getVar('table_column'); $value = wpl_request::getVar('value'); /** for checking limitation on feature and hot tag **/ if (($table_column == 'sp_featured' or $table_column == 'sp_hot') and $value == 1) { _wpl_import('libraries.property'); $current_user_id = wpl_users::get_cur_user_id(); $user_data = wpl_users::get_wpl_user($current_user_id); $user_limit = $table_column == 'sp_featured' ? $user_data->maccess_num_feat : $user_data->maccess_num_hot; $model = new wpl_property(); $used = $model->get_properties_count(" AND `user_id`='{$current_user_id}' AND `{$table_column}`='1'"); if ($used >= $user_limit and $user_limit != '-1') { self::response(array('success' => '0', 'message' => '', 'data' => '', 'js' => "wplj(form_element_id).prop('checked', false); wpl_alert(\"" . __('Your membership limit reached. contact to administrator if you want to upgrade!', WPL_TEXTDOMAIN) . "\");")); } } } } }
protected function generate_slide($category) { $tpl = wpl_flex::get_kind_tpl($this->tpl_path, 'internal_slide', $this->kind); $this->fields = wpl_property::get_pwizard_fields($category->id, $this->kind, 1); $this->field_category = $category; /** import tpl **/ parent::render($this->tpl_path, $tpl); }
/** * Listing Contact activity. It's for contacting to a listing agent. * @author Howard <*****@*****.**> * @static * @param array $params * @return boolean */ public static function contact_agent($params) { $replacements = $params[0]; $notification = new wpl_notifications('email'); $notification->prepare(2, $replacements); /** Disabled **/ if (!$notification->notification_data['enabled']) { return false; } $property = wpl_property::get_property_raw_data($params[0]['property_id']); $user = wpl_users::get_user($property['user_id']); $replacements['listing_id'] = $property['mls_id']; $notification->replacements = $notification->set_replacements($replacements); $notification->rendered_content = $notification->render_notification_content(); $notification->recipients = $notification->set_recipients(array($user->data->user_email)); $notification->send(); return true; }
private function contact_listing_user() { $fullname = wpl_request::getVar('fullname', ''); $phone = wpl_request::getVar('phone', ''); $email = wpl_request::getVar('email', ''); $message = wpl_request::getVar('message', ''); $property_id = wpl_request::getVar('pid', ''); $parameters = array('fullname' => $fullname, 'phone' => $phone, 'email' => $email, 'message' => $message, 'property_id' => $property_id, 'user_id' => wpl_property::get_property_user($property_id)); $returnData = array(); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $returnData['success'] = 0; $returnData['message'] = __('Your email is not a valid email!', WPL_TEXTDOMAIN); } else { wpl_events::trigger('contact_agent', $parameters); $returnData['success'] = 1; $returnData['message'] = __('Information sent to agent.', WPL_TEXTDOMAIN); } echo json_encode($returnData); exit; }
/** * This method is the main method of each commands * @return mixed */ public function build() { $settings = wpl_addon_mobile_application::get_settings(); $properties_count = wpl_property::get_properties_count(); print_r($this->get_listing_types()); die; foreach ($settings as $key => $values) { $name = strtoupper($values['name']); $value = $values['value']; $this->built["settings"]["app_settings"][] = array('name' => $name, 'value' => $value); if ($name == 'SHOW_BUBBLE_LIMITATION') { if ($properties_count <= $value) { $this->built["settings"]["app_settings"][] = array('name' => 'SHOW_BUBBLE', 'value' => 'true'); } else { $this->built["settings"]["app_settings"][] = array('name' => 'SHOW_BUBBLE', 'value' => 'false'); } } } $this->built['filter_fragment'] = $this->create_filter_fragment(); $this->built["settings"]['listing_types'] = $this->get_listing_types(); $this->built["settings"]['update_status'] = $this->get_update_status(); }
private function infowindow() { $wpl_property = new wpl_property(); $listing_fields = $wpl_property->get_plisting_fields(); $select = $wpl_property->generate_select($listing_fields, 'p'); $property_ids = wpl_request::getVar('property_ids', ''); $query = "SELECT " . $select . " FROM `#__wpl_properties` AS p WHERE 1 AND p.`deleted`='0' AND p.`finalized`='1' AND p.`confirmed`='1' AND p.`expired`='0' AND p.`id` IN (" . $property_ids . ")"; $properties = $wpl_property->search($query); /** plisting fields **/ $plisting_fields = $wpl_property->get_plisting_fields(); $this->wpl_properties = array(); foreach ($properties as $property) { $this->wpl_properties[$property->id] = $wpl_property->full_render($property->id, $plisting_fields, $property); } parent::render($this->tpl_path, 'infowindow'); exit; }
/** * Render gallery of a property based on custom sizes * @author Howard R <*****@*****.**> * @static * @param int $property_id * @param array $images * @param array $custom_sizes * @return array */ public static function render_gallery_custom_sizes($property_id, $images = '', $custom_sizes = array()) { $kind = wpl_property::get_property_kind($property_id); if (!$images) { $images = wpl_items::get_items($property_id, 'gallery', $kind); } /** no image gallery **/ if (!count($images)) { return array(); } $return = array(); foreach ($custom_sizes as $custom_size) { $custom_size = str_replace('*', '_', $custom_size); list($x, $y) = explode('_', $custom_size); if (trim($x) == '' or trim($y) == '') { continue; } if (!is_numeric($x) or !is_numeric($y)) { continue; } $i = 0; foreach ($images as $image) { /** force to array **/ $image = (array) $image; $source_path = self::get_path($image['parent_id'], $image['parent_kind']) . $image['item_name']; $source_url = self::get_folder($image['parent_id'], $image['parent_kind']) . $image['item_name']; $params = array('image_name' => $image['item_name'], 'image_source' => $source_path, 'image_parentid' => $image['parent_id'], 'image_parentkind' => $image['parent_kind']); /** taking care for external images **/ if ($image['item_cat'] != 'external') { $dest_url = wpl_images::create_gallary_image($x, $y, $params, 0, 0); $pathinfo = @pathinfo($dest_url); $dest_path = self::get_path($image['parent_id'], $image['parent_kind']) . $pathinfo['basename']; } else { $dest_url = $source_url; $pathinfo = @pathinfo($dest_url); $dest_path = $source_path; } $return[$custom_size][$i]['item_id'] = $image['id']; $return[$custom_size][$i]['custom_size'] = $custom_size; $return[$custom_size][$i]['path'] = $dest_path; $return[$custom_size][$i]['url'] = $dest_url; $return[$custom_size][$i]['size'] = @filesize($dest_path); $return[$custom_size][$i]['title'] = (string) $image['item_extra1']; $return[$custom_size][$i]['description'] = (string) $image['item_extra2']; $return[$custom_size][$i]['category'] = $image['item_cat']; $return[$custom_size][$i]['ext'] = $pathinfo['extension']; $return[$custom_size][$i]['raw'] = $image; $i++; } } return $return; }
url = window.location.href; url = wpl_update_qs('wplpage', page, url); window.location = url; } function wpl_generate_rss() { var rss = ''; rss = wpl_update_qs('wplpage', '', wpl_listing_request_str); rss = wpl_update_qs('wplview', '', rss); rss = wpl_update_qs('wplpagination', '', rss); window.open("<?php echo wpl_property::get_property_rss_link(); ?> ?"+rss); } <?php if (wpl_global::check_addon('aps')) { ?> function map_view_toggle_listing() { if(wplj('.map_view_handler').hasClass('op')) { wplj('.wpl_property_listing_list_view_container').animate({'margin-right': '-220px'}, function() { wplj('.map_view_handler').toggleClass('op'); });
$wpl_properties = isset($params['wpl_properties']) ? $params['wpl_properties'] : array(); /** Parameters **/ $this->params = $params; /** get params **/ $this->googlemap_view = isset($params['googlemap_view']) ? $params['googlemap_view'] : 'WPL'; $this->map_width = isset($params['map_width']) ? $params['map_width'] : 980; $this->map_height = isset($params['map_height']) ? $params['map_height'] : 480; $this->default_lt = isset($params['default_lt']) ? $params['default_lt'] : '38.685516'; $this->default_ln = isset($params['default_ln']) ? $params['default_ln'] : '-101.073324'; $this->default_zoom = isset($params['default_zoom']) ? $params['default_zoom'] : '4'; $this->infowindow_event = isset($params['infowindow_event']) ? $params['infowindow_event'] : 'click'; $this->overviewmap = isset($params['overviewmap']) ? $params['overviewmap'] : 0; $this->show_marker = 1; /** unset current key **/ unset($wpl_properties['current']); $this->markers = wpl_property::render_markers($wpl_properties); /** load js codes **/ $this->_wpl_import($this->tpl_path . '.scripts.js', true, true); $this->_wpl_import($this->tpl_path . '.scripts.default', true, true); /** Demographic **/ $this->demographic_status = isset($params['demographic']) ? $params['demographic'] : 0; if ($this->demographic_status and wpl_global::check_addon('demographic')) { $this->_wpl_import($this->tpl_path . '.scripts.addon_demographic', true, true); } /** Map Search **/ $this->map_search_status = isset($params['map_search']) ? $params['map_search'] : 0; if ($this->map_search_status and wpl_global::check_addon('aps')) { $this->_wpl_import($this->tpl_path . '.scripts.addon_aps', true, true); } ?> <div class="wpl_googlemap_container wpl_googlemap_plisting" id="wpl_googlemap_container<?php
private function set_parent() { $parent_id = wpl_request::getVar('parent_id', 0); $item_id = wpl_request::getVar('item_id', 0); $parent_data = wpl_property::get_property_raw_data($parent_id); $forbidden_fields = array('id', 'kind', 'deleted', 'mls_id', 'parent', 'pic_numb', 'att_numb', 'sent_numb', 'contact_numb', 'user_id', 'add_date', 'finalized', 'confirmed', 'visit_time', 'visit_date', 'last_modified_time_stamp', 'sp_featured', 'sp_hot', 'sp_openhouse', 'sp_forclosure', 'textsearch', 'property_title', 'location_text', 'vids_numb', 'rendered', 'alias'); $q = ''; foreach ($parent_data as $key => $value) { if (in_array($key, $forbidden_fields)) { continue; } $q .= "`{$key}`='{$value}', "; } $q .= trim($q, ', '); $query = "UPDATE `#__wpl_properties` SET `parent`='{$parent_id}', {$q} WHERE `id`='{$item_id}'"; wpl_db::q($query); echo json_encode(array('success' => 1)); exit; }
echo wpl_global::get_wpl_asset_url('img/ajax-loader3.gif'); ?> " /></div> <div id="wpl_slide_container_id10000_after_save" class="hide"> <div class="after-finilize-wp"> <div class="finilize-icon"></div> <div class="message-wp"> <span> <?php echo __('Your property successfully finalized!', WPL_TEXTDOMAIN); ?> </span> <div class="finilize-btn-wp"> <?php $listing_target_page = wpl_global::get_client() == 1 ? wpl_global::get_setting('backend_listing_target_page') : NULL; $property_link = wpl_property::get_property_link('', $this->property_id, $listing_target_page); $new_link = wpl_global::remove_qs_var('pid', wpl_global::get_full_url()); if ($this->kind) { $new_link = wpl_global::add_qs_var('kind', $this->kind, $new_link); } if (wpl_global::get_client() == 1) { $manager_link = wpl_global::add_qs_var('kind', $this->kind, wpl_global::get_wpl_admin_menu('wpl_admin_listings')); } else { $manager_link = wpl_global::add_qs_var('kind', $this->kind, wpl_global::remove_qs_var('wplmethod', wpl_global::remove_qs_var('pid'))); } ?> <a class="wpl-button button-2" target="_blank" href="<?php echo $property_link; ?> "><?php echo __('View this listing', WPL_TEXTDOMAIN);
<?php defined('_WPLEXEC') or die('Restricted access'); /** add Layout js **/ $js[] = (object) array('param1' => 'jquery.checkbox', 'param2' => 'packages/jquery.ui/checkbox/jquery.checkbox.js'); foreach ($js as $javascript) { wpl_extensions::import_javascript($javascript); } $bott_div_open = false; ?> <form action="<?php echo wpl_property::get_property_listing_link(); ?> " id="wpl_search_form_<?php echo $widget_id; ?> " method="GET" onsubmit="return wpl_do_search_<?php echo $widget_id; ?> ();" class="wpl_search_from_box simple clearfix wpl_search_kind<?php echo $this->kind; ?> <?php echo $this->css_class; ?> "> <!-- Do not change the ID --> <div id="wpl_searchwidget_<?php echo $widget_id; ?> " class="clearfix">
/** * Returns all WPL item links (Used in sitemap feature) * @author Howard <*****@*****.**> * @static * @since 1.8.0 * @param array $exclude * @return array */ public static function get_wpl_item_links($exclude = array()) { $links = array(); /** WPL Properties **/ $properties = wpl_property::select_active_properties(NULL, '`id`'); foreach ($properties as $property) { /** exclude **/ if (isset($exclude['properties']) and in_array($property['id'], $exclude['properties'])) { continue; } $property_data = wpl_db::select("SELECT `id`,`alias`,`last_modified_time_stamp` FROM `#__wpl_properties` WHERE `id`='" . $property['id'] . "'", 'loadAssoc'); $link = wpl_property::get_property_link($property_data); $links[] = array('link' => $link, 'time' => strtotime($property_data['last_modified_time_stamp'])); } /** WPL Profiles **/ $profiles = wpl_users::get_wpl_users(); foreach ($profiles as $profile) { /** exclude **/ if (isset($exclude['profiles']) and in_array($profile->ID, $exclude['profiles'])) { continue; } $link = wpl_users::get_profile_link($profile->ID); $links[] = array('link' => $link, 'time' => strtotime($profile->last_modified_time_stamp)); } return $links; }
$value = rtrim($value, ','); if ($value != '') { $query .= " AND `" . $table_column . "` IN (" . $value . ")"; } } $done_this = true; } elseif ($format == 'notselect' and !$done_this) { if ($value != '-1' and trim($value) != '') { $query .= " AND `" . $table_column . "` != '" . $value . "'"; } $done_this = true; } elseif ($format == 'parent' and !$done_this) { if ($value != '-1' and trim($value) != '') { /** converts listing id to property id **/ if ($value) { $value = wpl_property::pid($value); } $query .= " AND `parent` = '" . $value . "'"; } $done_this = true; } elseif ($format == 'textsearch' and !$done_this) { if (trim($value) != '') { $query .= " AND `" . $table_column . "` LIKE '%" . $value . "%'"; } $done_this = true; } elseif ($format == 'text' and !$done_this) { if (trim($value) != '') { $query .= " AND `" . $table_column . "` LIKE '%" . $value . "%'"; } $done_this = true; } elseif ($format == 'unit' and !$done_this) {
/** * Sets Dublin Core Meta Tags * @author Howard <*****@*****.**> * @return boolean */ public function dublincore() { $settings = wpl_global::get_settings(); $dc_status = isset($settings['dc_status']) ? $settings['dc_status'] : false; /** check status of geo tags **/ if (!$dc_status) { return false; } $current_link_url = wpl_global::get_full_url(); $html = wpl_html::getInstance(); /** WPL views and WordPress views (Page/Post) **/ if (trim($this->view) != '' and $dc_status == 2 or $dc_status == 1) { if (trim($settings['dc_coverage']) != '') { $html->set_custom_tag('<meta name="DC.coverage" content="' . $settings['dc_coverage'] . '" />'); } if (trim($settings['dc_contributor']) != '') { $html->set_custom_tag('<meta name="DC.contributor" content="' . $settings['dc_contributor'] . '" />'); } if (trim($settings['dc_publisher']) != '') { $html->set_custom_tag('<meta name="DC.publisher" content="' . $settings['dc_publisher'] . '" />'); } if (trim($settings['dc_copyright']) != '') { $html->set_custom_tag('<meta name="DC.rights" content="' . $settings['dc_copyright'] . '" />'); } if (trim($settings['dc_source']) != '') { $html->set_custom_tag('<meta name="DC.source" content="' . $settings['dc_source'] . '" />'); } if (trim($settings['dc_relation']) != '') { $html->set_custom_tag('<meta name="DC.relation" content="' . $settings['dc_relation'] . '" />'); } $html->set_custom_tag('<meta name="DC.type" content="Text" />'); $html->set_custom_tag('<meta name="DC.format" content="text/html" />'); $html->set_custom_tag('<meta name="DC.identifier" content="' . $current_link_url . '" />'); $locale = apply_filters('plugin_locale', get_locale(), WPL_TEXTDOMAIN); $html->set_custom_tag('<meta name="DC.language" scheme="RFC1766" content="' . $locale . '" />'); } if ($this->view == 'property_show') { $proeprty_id = wpl_request::getVar('pid'); $property_data = wpl_property::get_property_raw_data($proeprty_id); $user_data = (array) wpl_users::get_user($property_data['user_id']); $html->set_custom_tag('<meta name="DC.title" content="' . $this->property_page_title . '" />'); $html->set_custom_tag('<meta name="DC.subject" content="' . $this->property_page_title . '" />'); $html->set_custom_tag('<meta name="DC.description" content="' . $this->property_description . '" />'); $html->set_custom_tag('<meta name="DC.date" content="' . $property_data['add_date'] . '" />'); $html->set_custom_tag('<meta name="DC.creator" content="' . $user_data['data']->user_login . '" />'); } elseif ($this->view == 'profile_show') { $user_id = wpl_request::getVar('uid'); $user_data = (array) wpl_users::get_user($user_id); $html->set_custom_tag('<meta name="DC.title" content="' . $this->user_title . '" />'); $html->set_custom_tag('<meta name="DC.subject" content="' . $this->user_title . '" />'); $html->set_custom_tag('<meta name="DC.description" content="' . $this->user_description . '" />'); $html->set_custom_tag('<meta name="DC.date" content="' . $user_data['data']->user_registered . '" />'); $html->set_custom_tag('<meta name="DC.creator" content="' . $user_data['data']->user_login . '" />'); } elseif (is_single()) { $post_author_id = wpl_global::get_post_field('post_author'); $author_username = wpl_global::get_the_author_meta('user_login', $post_author_id); $html->set_custom_tag('<meta name="DC.title" content="' . wpl_global::get_the_title() . '" />'); $html->set_custom_tag('<meta name="DC.subject" content="' . wpl_global::get_the_title() . '" />'); $html->set_custom_tag('<meta name="DC.date" content="' . wpl_global::get_the_date() . '" />'); $html->set_custom_tag('<meta name="DC.creator" content="' . $author_username . '" />'); } }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); if ($type == 'parent' and !$done_this) { /** converts property id to listing id **/ if ($value) { $value = wpl_property::listing_id($value); } $parent_kind = isset($options['parent_kind']) ? $options['parent_kind'] : 0; $replace = isset($options['replace']) ? $options['replace'] : 1; $parent_key = isset($options['key']) ? $options['key'] : 'parent'; wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-autocomplete'); ?> <label for="wpl_c_<?php echo $field->id; ?> "><?php echo __($label, WPL_TEXTDOMAIN); if (in_array($mandatory, array(1, 2))) { ?> <span class="required-star">*</span><?php } ?> </label> <input type="text" class="wpl_c_<?php echo $field->table_column; ?> " id="wpl_c_<?php echo $field->id;
/** * Removes WPL cached data * @author Howard <*****@*****.**> * @static * @param type $cache_type * @return boolean */ public static function clear_cache($cache_type = 'all') { /** first validation **/ $cache_type = strtolower($cache_type); if (trim($cache_type) == '') { return false; } /** import libraries **/ _wpl_import('libraries.property'); _wpl_import('libraries.items'); if ($cache_type == 'unfinalized_properties' or $cache_type == 'all') { $properties = wpl_db::select("SELECT `id` FROM `#__wpl_properties` WHERE `finalized`='0'", 'loadAssocList'); foreach ($properties as $property) { wpl_property::purge($property['id']); } } if ($cache_type == 'properties_cached_data' or $cache_type == 'all') { $q = " `location_text`='', `rendered`='', `alias`=''"; if (wpl_global::check_multilingual_status()) { $q = self::get_multilingual_query(array('alias', 'location_text', 'rendered')); } $query = "UPDATE `#__wpl_properties` SET " . $q; wpl_db::q($query); } if ($cache_type == 'location_texts' or $cache_type == 'all') { $q = " `location_text`=''"; if (wpl_global::check_multilingual_status()) { $q = self::get_multilingual_query(array('location_text')); } $query = "UPDATE `#__wpl_properties` SET " . $q; wpl_db::q($query); } if ($cache_type == 'listings_thumbnails' or $cache_type == 'all') { $properties = wpl_db::select("SELECT `id`, `kind` FROM `#__wpl_properties` WHERE `id`>0", 'loadAssocList'); $ext_array = array('jpg', 'jpeg', 'gif', 'png'); foreach ($properties as $property) { $path = wpl_items::get_path($property['id'], $property['kind']); $thumbnails = wpl_folder::files($path, 'th.*\\.(' . implode('|', $ext_array) . ')$', 3, true); foreach ($thumbnails as $thumbnail) { wpl_file::delete($thumbnail); } } } if ($cache_type == 'users_cached_data' or $cache_type == 'all') { $q = " `location_text`='', `rendered`=''"; if (wpl_global::check_multilingual_status()) { $q = self::get_multilingual_query(array('location_text', 'rendered'), 'wpl_users'); } $query = "UPDATE `#__wpl_users` SET " . $q; wpl_db::q($query); } if ($cache_type == 'users_thumbnails' or $cache_type == 'all') { $users = wpl_db::select("SELECT `id` FROM `#__wpl_users` WHERE `id`>0", 'loadAssocList'); $ext_array = array('jpg', 'jpeg', 'gif', 'png'); foreach ($users as $user) { $path = wpl_items::get_path($user['id'], 2); $thumbnails = wpl_folder::files($path, 'th.*\\.(' . implode('|', $ext_array) . ')$', 3, true); foreach ($thumbnails as $thumbnail) { wpl_file::delete($thumbnail); } } } /** trigger event **/ wpl_global::event_handler('cache_cleared', array('cache_type' => $cache_type)); return true; }
echo $widget_id; ?> _', 'sf_') +"=" + value; } } }); /** Adding widget id **/ request_str = 'widget_id=<?php echo $widget_id; ?> '+request_str; /** Create full url of search **/ search_page = '<?php echo wpl_property::get_property_listing_link($target_id); ?> '; if(search_page.indexOf('?') >= 0) search_str = search_page+'&'+request_str else search_str = search_page+'?'+request_str window.location = search_str; return false; } function wpl_sef_request<?php echo $widget_id; ?> (request_str) {
private function assign_related_properties() { $property_type_id = wpl_request::getVar('property_type_id'); $select_id = wpl_request::getVar('select_id'); $j = wpl_property::update_properties('property_type', $property_type_id, $select_id); self::remove_property_type($property_type_id, 1); }
public function display($instance = array()) { /** do cronjobs **/ _wpl_import('libraries.events'); wpl_events::do_cronjobs(); /** check access **/ if (!wpl_users::check_access('propertyshow')) { /** import message tpl **/ $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message', false, true); } $this->tpl = wpl_request::getVar('tpl', 'default'); /** property listing model **/ $this->model = new wpl_property(); $this->pid = wpl_request::getVar('pid', 0); $listing_id = wpl_request::getVar('mls_id', 0); if (trim($listing_id)) { $this->pid = wpl_property::pid($listing_id); wpl_request::setVar('pid', $this->pid); } $property = $this->model->get_property_raw_data($this->pid); /** no property found **/ if (!$property or $property['finalized'] == 0 or $property['confirmed'] == 0 or $property['deleted'] == 1 or $property['expired'] >= 1) { /** import message tpl **/ $this->message = __("No property found or it's not available now!", WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message', false, true); } $this->pshow_fields = $this->model->get_pshow_fields('', $property['kind']); $this->pshow_categories = wpl_flex::get_categories('', '', " AND `enabled`>='1' AND `kind`='" . $property['kind'] . "' AND `pshow`='1'"); $wpl_properties = array(); /** define current index **/ $wpl_properties['current']['data'] = (array) $property; $wpl_properties['current']['raw'] = (array) $property; $find_files = array(); $rendered_fields = $this->model->render_property($property, $this->pshow_fields, $find_files, true); $wpl_properties['current']['rendered_raw'] = $rendered_fields['ids']; $wpl_properties['current']['materials'] = $rendered_fields['columns']; foreach ($this->pshow_categories as $pshow_category) { $pshow_cat_fields = $this->model->get_pshow_fields($pshow_category->id, $property['kind']); $wpl_properties['current']['rendered'][$pshow_category->id]['self'] = (array) $pshow_category; $wpl_properties['current']['rendered'][$pshow_category->id]['data'] = $this->model->render_property($property, $pshow_cat_fields); } $wpl_properties['current']['items'] = wpl_items::get_items($this->pid, '', $property['kind'], '', 1); /** property location text **/ $wpl_properties['current']['location_text'] = $this->model->generate_location_text((array) $property); /** property full link **/ $wpl_properties['current']['property_link'] = $this->model->get_property_link((array) $property); /** property page title **/ $wpl_properties['current']['property_page_title'] = $this->model->update_property_page_title($property); /** property title **/ $wpl_properties['current']['property_title'] = $this->model->update_property_title($property); /** apply filters (This filter must place after all proccess) **/ _wpl_import('libraries.filters'); @extract(wpl_filters::apply('property_listing_after_render', array('wpl_properties' => $wpl_properties))); $this->wpl_properties = $wpl_properties; $this->kind = $property['kind']; $this->property = $wpl_properties['current']; /** updating the visited times and etc **/ wpl_property::property_visited($this->pid); /** trigger event **/ wpl_global::event_handler('property_show', array('id' => $this->pid)); /** import tpl **/ $this->tpl = wpl_flex::get_kind_tpl($this->tpl_path, $this->tpl, $this->kind); return parent::render($this->tpl_path, $this->tpl, false, true); }
?> "></i> </div> <div id="pmanager_delete<?php echo $pid; ?> " class="p-action-btn" onclick="purge_property(<?php echo $pid; ?> );"> <span><?php echo __('Purge', WPL_TEXTDOMAIN); ?> </span> <i class="icon-delete"></i> </div> <a id="pmanager_edit<?php echo $pid; ?> " class="p-action-btn" href="<?php echo wpl_property::get_property_edit_link($pid); ?> "> <span><?php echo __('Edit', WPL_TEXTDOMAIN); ?> </span> <i class="icon-edit"></i> </a> </div>
/** * Updates properties and regenerate some of cached property data * @author Howard R <*****@*****.**> * @static * @param string $column * @param mixed $previous_value * @param mixed $new_value * @return boolean */ public static function update_properties($column, $previous_value, $new_value) { $listings = wpl_property::get_properties_list($column, $previous_value); $query = "UPDATE `#__wpl_properties` SET `{$column}`='{$new_value}' WHERE `{$column}`='{$previous_value}'"; $result = wpl_db::q($query); foreach ($listings as $listing) { $pid = $listing['id']; $property = self::get_property_raw_data($pid); wpl_property::update_text_search_field($pid); wpl_property::update_alias($property, $pid); wpl_property::update_numbs($pid, $property); /** generate rendered data **/ if (wpl_settings::get('cache')) { wpl_property::generate_rendered_data($pid); } } return $result; }
/** * Updates latitude and longitude of a property * @author Howard <*****@*****.**> * @static * @param type $property_data * @param type $property_id * @return type */ public static function update_LatLng($property_data, $property_id = NULL) { /** fetch property data if property id is setted **/ if ($property_id) { $property_data = wpl_property::get_property_raw_data($property_id); } if (!$property_id) { $property_id = $property_data['id']; } $location_text = wpl_property::generate_location_text($property_data); $LatLng = self::get_LatLng($location_text); if ($LatLng[0] and $LatLng[1]) { $query = "UPDATE `#__wpl_properties` SET `googlemap_lt`='" . $LatLng[0] . "', `googlemap_ln`='" . $LatLng[1] . "' WHERE `id`='{$property_id}'"; wpl_db::q($query); } $latitude = $LatLng[0] ? $LatLng[0] : $property_data['googlemap_lt']; $longitude = $LatLng[1] ? $LatLng[1] : $property_data['googlemap_ln']; return array($latitude, $longitude); }
private function assign_related_properties() { $listing_type_id = wpl_request::getVar('listing_type_id'); $select_id = wpl_request::getVar('select_id'); $j = wpl_property::update_properties('listing', $listing_type_id, $select_id); $this->remove_listing_type($listing_type_id, 1); }
$smart_resize = isset($this->instance['data']['smart_resize']) ? $this->instance['data']['smart_resize'] : false; $slide_interval = isset($this->instance['data']['slide_interval']) ? $this->instance['data']['slide_interval'] : 3000; /** add Layout js **/ $js[] = (object) array('param1' => 'modern.slider', 'param2' => 'js/libraries/wpl.modern.slider.min.js'); foreach ($js as $javascript) { wpl_extensions::import_javascript($javascript); } $larg_images = $thumbnail = NULL; foreach ($wpl_properties as $key => $gallery) { if (isset($gallery["items"]["gallery"][0])) { $params = array(); $params['image_name'] = $gallery["items"]["gallery"][0]->item_name; $params['image_parentid'] = $gallery["items"]["gallery"][0]->parent_id; $params['image_parentkind'] = $gallery["items"]["gallery"][0]->parent_kind; $params['image_source'] = wpl_global::get_upload_base_path() . $params['image_parentid'] . DS . $params['image_name']; $image_title = wpl_property::update_property_title($gallery['raw']); if (isset($gallery['items']['gallery'][0]->item_extra2) and trim($gallery['items']['gallery'][0]->item_extra2) != '') { $image_alt = $gallery['items']['gallery'][0]->item_extra2; } else { $image_alt = $gallery['raw']['meta_keywords']; } $image_description = $gallery["items"]["gallery"][0]->item_extra2; if ($gallery["items"]["gallery"][0]->item_cat != 'external') { $image_url = wpl_images::create_gallary_image($image_width, $image_height, $params); $thumbnail_url = wpl_images::create_gallary_image($thumbnail_width, $thumbnail_height, $params); } else { $image_url = $gallery["items"]["gallery"][0]->item_extra3; $thumbnail_url = $gallery["items"]["gallery"][0]->item_extra3; } $larg_images .= ' <li>
$image_width = isset($this->instance['data']['image_width']) ? $this->instance['data']['image_width'] : 90; $image_height = isset($this->instance['data']['image_height']) ? $this->instance['data']['image_height'] : 82; ?> <div class="wpl_carousel_container"> <ul class="simple_list"> <?php foreach ($wpl_properties as $key => $gallery) { if (!isset($gallery["items"]["gallery"][0])) { continue; } $params = array(); $params['image_name'] = $gallery["items"]["gallery"][0]->item_name; $params['image_parentid'] = $gallery["items"]["gallery"][0]->parent_id; $params['image_parentkind'] = $gallery["items"]["gallery"][0]->parent_kind; $params['image_source'] = wpl_global::get_upload_base_path() . $params['image_parentid'] . DS . $params['image_name']; $image_title = isset($gallery['property_title']) ? $gallery['property_title'] : wpl_property::update_property_title($gallery['raw']); if (isset($gallery['items']['gallery'][0]->item_extra2) and trim($gallery['items']['gallery'][0]->item_extra2) != '') { $image_alt = $gallery['items']['gallery'][0]->item_extra2; } else { $image_alt = $gallery['raw']['meta_keywords']; } $image_description = $gallery["items"]["gallery"][0]->item_extra2; if ($gallery["items"]["gallery"][0]->item_cat != 'external') { $image_url = wpl_images::create_gallary_image($image_width, $image_height, $params); } else { $image_url = $gallery["items"]["gallery"][0]->item_extra3; } echo ' <li> <div class="left_section"> <a itemprop="url" href="' . $gallery["property_link"] . '"><span style="width:' . $image_width . 'px;height:' . $image_height . 'px;"><img itemprop="image" src="' . $image_url . '" title="' . $image_title . '" alt="' . $image_alt . '" width="' . $image_width . '" height="' . $image_height . '" style="width: ' . $image_width . 'px; height: ' . $image_height . 'px;" /></span></a>
?> " onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=600'); return false;"><?php echo __('Pin it', WPL_TEXTDOMAIN); ?> </a> </li> <?php } ?> <?php if ($show_pdf) { ?> <li class="pdf_link"> <a href="<?php echo wpl_property::get_property_pdf_link($property_id); ?> " target="_blank"><?php echo __('PDF', WPL_TEXTDOMAIN); ?> </a> </li> <?php } ?> <?php if ($show_favorite) { ?> <?php $find_favorite_item = in_array($property_id, wpl_addon_pro::favorite_get_pids());
private function query($instance) { /** property listing model **/ $model = new wpl_property(); $data = $instance['data']; $this->start = 0; $this->limit = $data['limit']; $this->orderby = urldecode($data['orderby']); $this->order = $data['order']; /** detect kind **/ if (isset($data['kind']) and (trim($data['kind']) != '' or trim($data['kind']) != '-1')) { $kind = $data['kind']; } else { $kind = 0; } $where = array('sf_select_confirmed' => 1, 'sf_select_finalized' => 1, 'sf_select_deleted' => 0, 'sf_select_expired' => 0, 'sf_select_kind' => $kind); if (trim($data['listing']) and $data['listing'] != '-1') { $where['sf_select_listing'] = $data['listing']; } if (trim($data['property_type']) and $data['property_type'] != '-1') { $where['sf_select_property_type'] = $data['property_type']; } if (trim($data['property_ids'])) { $where['sf_multiple_id'] = trim($data['property_ids'], ', '); } if (trim($data['only_featured'])) { $where['sf_select_sp_featured'] = 1; } if (trim($data['only_hot'])) { $where['sf_select_sp_hot'] = 1; } if (trim($data['only_openhouse'])) { $where['sf_select_sp_openhouse'] = 1; } if (trim($data['only_forclosure'])) { $where['sf_select_sp_forclosure'] = 1; } /** Parent **/ if (isset($data['parent']) and trim($data['parent'])) { $where['sf_parent'] = $data['parent']; } if (isset($data['auto_parent']) and trim($data['auto_parent'])) { /** current proeprty id - This features works only in single property page **/ $property_data = NULL; $pid = wpl_request::getVar('pid', 0); if ($pid) { $property_data = $model->get_property_raw_data($pid); } if (isset($property_data['mls_id'])) { $where['sf_parent'] = $property_data['mls_id']; } } if (isset($data['random']) and trim($data['random']) and trim($data['property_ids']) == '') { $query_rand = "SELECT p.`id` FROM `#__wpl_properties` AS p WHERE 1 " . wpl_db::create_query($where) . " ORDER BY RAND() LIMIT " . $this->limit; $results = wpl_db::select($query_rand); $rand_ids = array(); foreach ($results as $result) { $rand_ids[] = $result->id; } $where['sf_multiple_id'] = implode(',', $rand_ids); } /** Similar properties **/ if (isset($data['sml_only_similars']) and $data['sml_only_similars']) { $sml_where = array('sf_select_confirmed' => 1, 'sf_select_finalized' => 1, 'sf_select_deleted' => 0, 'sf_select_expired' => 0); /** current proeprty id - This features works only in single property page **/ $pid = wpl_request::getVar('pid', 0); $property_data = wpl_property::get_property_raw_data($pid); if ($property_data) { $sml_where['sf_notselect_id'] = $pid; $sml_where['sf_select_kind'] = $property_data['kind']; if (isset($data['sml_inc_listing']) and $data['sml_inc_listing']) { $sml_where['sf_select_listing'] = $property_data['listing']; } if (isset($data['sml_inc_property_type']) and $data['sml_inc_property_type']) { $sml_where['sf_select_property_type'] = $property_data['property_type']; } if (isset($data['sml_inc_price']) and $data['sml_inc_price']) { $down_rate = $data['sml_price_down_rate'] ? $data['sml_price_down_rate'] : 0.8; $up_rate = $data['sml_price_up_rate'] ? $data['sml_price_up_rate'] : 1.2; $price_down_range = $property_data['price_si'] * $down_rate; $price_up_range = $property_data['price_si'] * $up_rate; $sml_where['sf_tmin_price_si'] = $price_down_range; $sml_where['sf_tmax_price_si'] = $price_up_range; } if (isset($data['sml_inc_radius']) and $data['sml_inc_radius']) { $latitude = $property_data['googlemap_lt']; $longitude = $property_data['googlemap_ln']; $radius = $data['sml_radius']; $unit_id = $data['sml_radius_unit']; if ($latitude and $longitude and $radius and $unit_id) { $sml_where['sf_radiussearchunit'] = $unit_id; $sml_where['sf_radiussearch_lat'] = $latitude; $sml_where['sf_radiussearch_lng'] = $longitude; $sml_where['sf_radiussearchradius'] = $radius; } } } /** overwrite $where if similar where is correct **/ if (count($sml_where) > 3) { $where = $sml_where; } } /** start search **/ $model->start($this->start, $this->limit, $this->orderby, $this->order, $where); /** run the search **/ return $model->query(); }
/** * Renders profile data * @author Howard R <*****@*****.**> * @static * @param array $profile * @param array $fields * @param array $finds * @param boolean $material * @return array */ public static function render_profile($profile, $fields, &$finds = array(), $material = false) { _wpl_import('libraries.property'); return wpl_property::render_property($profile, $fields, $finds, $material); }
public function get_target_page($target_id = NULL) { if (trim($target_id) and $target_id == '-1') { $target_page = wpl_global::get_full_url(); } else { $target_page = wpl_property::get_property_listing_link($target_id); } return $target_page; }