public function upload() { /** import upload library **/ _wpl_import('assets.packages.ajax_uploader.UploadHandler'); $kind = wpl_request::getVar('kind', 0); $params = array(); $params['accept_ext'] = wpl_flex::get_field_options(301); $extentions = explode(',', $params['accept_ext']['ext_file']); $ext_str = ''; foreach ($extentions as $extention) { $ext_str .= $extention . '|'; } // remove last | $ext_str = substr($ext_str, 0, -1); $ext_str = rtrim($ext_str, ';'); $custom_op = array('upload_dir' => wpl_global::get_upload_base_path(), 'upload_url' => wpl_global::get_upload_base_url(), 'accept_file_types' => '/\\.(' . $ext_str . ')$/i', 'max_file_size' => $params['accept_ext']['file_size'] * 1000, 'min_file_size' => 1, 'max_number_of_files' => null); $upload_handler = new UploadHandler($custom_op); $response = json_decode($upload_handler->json_response); if (isset($response->files[0]->error)) { return; } $attachment_categories = wpl_items::get_item_categories('attachment', $kind); // get item category with first index $item_cat = reset($attachment_categories)->category_name; $index = floatval(wpl_items::get_maximum_index(wpl_request::getVar('pid'), wpl_request::getVar('type'), $kind, $item_cat)) + 1.0; $item = array('parent_id' => wpl_request::getVar('pid'), 'parent_kind' => $kind, 'item_type' => wpl_request::getVar('type'), 'item_cat' => $item_cat, 'item_name' => $response->files[0]->name, 'creation_date' => date("Y-m-d H:i:s"), 'index' => $index); wpl_items::save($item); }
private function save_multilingual() { $dbst_id = wpl_request::getVar('dbst_id'); $value = wpl_db::escape(wpl_request::getVar('value')); $item_id = wpl_request::getVar('item_id'); $lang = wpl_request::getVar('lang'); $field = wpl_flex::get_field($dbst_id); $table_name = $field->table_name; $table_column1 = wpl_addon_pro::get_column_lang_name($field->table_column, $lang, false); $default_language = wpl_addon_pro::get_default_language(); $table_column2 = NULL; if (strtolower($default_language) == strtolower($lang)) { $table_column2 = wpl_addon_pro::get_column_lang_name($field->table_column, $lang, true); } wpl_db::set($table_name, $item_id, $table_column1, $value, 'id'); if ($table_column2) { wpl_db::set($table_name, $item_id, $table_column2, $value, 'id'); } $res = 1; $message = $res ? __('Saved.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN); $data = NULL; $response = array('success' => $res, 'message' => $message, 'data' => $data); echo json_encode($response); exit; }
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); }
public function build() { /** property listing model **/ $this->model = new wpl_property(); $property = (array) $this->model->get_property_raw_data($this->pid); /** no property found **/ if (!$property) { $this->error = "ERROR: Property id is not valid."; return false; } $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'"); /** BUILD **/ $this->built['listing']['raw'] = $property; $find_files = array(); $rendered_fields = $this->model->render_property($property, $this->pshow_fields, $find_files, true); $this->built['listing']['materials'] = $rendered_fields['columns']; foreach ($this->pshow_categories as $pshow_category) { $pshow_cat_fields = $this->model->get_pshow_fields($pshow_category->id, $property['kind']); $this->built['listing']['rendered'][$pshow_category->id]['self'] = (array) $pshow_category; $this->built['listing']['rendered'][$pshow_category->id]['data'] = $this->model->render_property($property, $pshow_cat_fields); } $items = wpl_items::get_items($this->pid, '', $property['kind'], '', 1); /** render gallery **/ $this->built['listing']['images'] = wpl_items::render_gallery($items['gallery']); /** render attachments **/ $this->built['listing']['attachments'] = wpl_items::render_attachments($items['attachment']); /** render videos **/ $this->built['listing']['videos'] = wpl_items::render_videos($items['video']); /** render rooms **/ $this->built['listing']['rooms'] = $items['rooms']; /** render gallery custom sizes **/ if (is_array($this->image_sizes)) { $this->built['listing']['custom_sizes'] = wpl_items::render_gallery_custom_sizes($this->pid, $items['gallery'], $this->image_sizes); } /** property full link **/ $this->built['listing']['property_link'] = $this->model->get_property_link($property); /** location text **/ $this->built['listing']['location_text'] = $property['location_text']; /** render agent data **/ $rendered_agent = wpl_users::full_render($property['user_id']); unset($rendered_agent['data']); $this->built['listing']['agent'] = $rendered_agent; /** updating the visited times and etc **/ $this->model->property_visited($this->pid); return $this->built; }
public function profile($instance = array()) { /** check access **/ if (!wpl_users::check_access('profilewizard')) { /** import message tpl **/ $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message'); } _wpl_import('libraries.flex'); $this->tpl = 'profile'; $this->kind = wpl_flex::get_kind_id('user'); $this->user_id = wpl_users::get_cur_user_id(); if (wpl_users::is_administrator($this->user_id) and wpl_request::getVar('id', 0)) { $this->user_id = wpl_request::getVar('id'); } $this->user_fields = wpl_flex::get_fields('', 1, $this->kind, 'pwizard', 1); $this->user_data = (array) wpl_users::get_wpl_data($this->user_id); /** import tpl **/ parent::render($this->tpl_path, $this->tpl); }
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); }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); ?> <!-- do not change this id --> <div class="fanc-content size-width-2" id="wpl_flex_modify_container"> <h2><?php echo __('General Options', WPL_TEXTDOMAIN); ?> </h2> <?php // load::libraries/dbst_modify/main wpl_flex::generate_modify_form($this->field_type, $this->field_id, $this->kind); /** including a custom file **/ $this->_wpl_import($this->tpl_path . '.custom.modifydbst'); ?> </div>
public function render_search_fields($instance, $widget_id, $finds = array()) { /** first validation **/ if (!$instance) { return array(); } $path = WPL_ABSPATH . DS . 'libraries' . DS . 'widget_search' . DS . 'frontend'; $files = array(); if (wpl_folder::exists($path)) { $files = wpl_folder::files($path, '.php$'); } $fields = $instance['data']; uasort($fields, array('wpl_global', 'wpl_array_sort')); $rendered = array(); foreach ($fields as $key => $field) { /** proceed to next field if field is not enabled **/ if (!isset($field['enable']) or isset($field['enable']) and $field['enable'] != 'enable') { continue; } /** Fix empty id issue **/ if ((!isset($field['id']) or isset($field['id']) and !$field['id']) and $key) { $field['id'] = $key; } $field_data = (array) wpl_flex::get_field($field['id']); if (!$field_data) { continue; } $field['name'] = $field_data['name']; $type = $field_data['type']; $field_id = $field['id']; $options = json_decode($field_data['options'], true); $display = ''; $done_this = false; $html = ''; /** listing and property type specific **/ if (trim($field_data['listing_specific']) != '') { $specified_listings = explode(',', trim($field_data['listing_specific'], ', ')); $this->listing_specific_array[$field_data['id']] = $specified_listings; } elseif (trim($field_data['property_type_specific']) != '') { $specified_property_types = explode(',', trim($field_data['property_type_specific'], ', ')); $this->property_type_specific_array[$field_data['id']] = $specified_property_types; } /** Accesses **/ if (trim($field_data['accesses']) != '') { $accesses = explode(',', trim($field_data['accesses'], ', ')); $cur_membership_id = wpl_users::get_user_membership(); if (!in_array($cur_membership_id, $accesses)) { continue; } } if (isset($finds[$type])) { $html .= '<div class="wpl_search_field_container ' . (isset($field['type']) ? $field['type'] . '_type' : '') . ' ' . ((isset($field['type']) and $field['type'] == 'predefined') ? 'wpl_hidden' : '') . '" id="wpl' . $widget_id . '_search_field_container_' . $field['id'] . '">'; include $path . DS . $finds[$type]; $html .= '</div>'; $rendered[$field_id]['id'] = $field_id; $rendered[$field_id]['field_data'] = $field_data; $rendered[$field_id]['field_options'] = json_decode($field_data['options'], true); $rendered[$field_id]['search_options'] = isset($field['extoption']) ? $field['extoption'] : NULL; $rendered[$field_id]['html'] = $html; $rendered[$field_id]['current_value'] = isset($current_value) ? $current_value : NULL; $rendered[$field_id]['display'] = $display; continue; } $html .= '<div class="wpl_search_field_container ' . (isset($field['type']) ? $field['type'] . '_type' : '') . ' ' . ((isset($field['type']) and $field['type'] == 'predefined') ? 'wpl_hidden' : '') . '" id="wpl' . $widget_id . '_search_field_container_' . $field['id'] . '" style="' . $display . '">'; foreach ($files as $file) { include $path . DS . $file; /** proceed to next field **/ if ($done_this) { $finds[$type] = $file; break; } } $html .= '</div>'; $rendered[$field_id]['id'] = $field_id; $rendered[$field_id]['field_data'] = $field_data; $rendered[$field_id]['field_options'] = json_decode($field_data['options'], true); $rendered[$field_id]['search_options'] = isset($field['extoption']) ? $field['extoption'] : NULL; $rendered[$field_id]['html'] = $html; $rendered[$field_id]['current_value'] = isset($current_value) ? $current_value : NULL; $rendered[$field_id]['display'] = $display; } return $rendered; }
?> kind" id="<?php echo $__prefix; ?> kind" value="<?php echo $kind; ?> " /> <input type="hidden" name="<?php echo $__prefix; ?> table_name" id="<?php echo $__prefix; ?> table_name" value="<?php echo wpl_flex::get_kind_table($kind); ?> " /> </div> <div class="fanc-row"> <label for="<?php echo $__prefix; ?> name"><?php echo __('Name', WPL_TEXTDOMAIN); ?> </label> <input type="text" name="<?php echo $__prefix; ?> name" id="<?php
_wpl_import($this->tpl_path . '.scripts.js'); _wpl_import($this->tpl_path . '.scripts.css'); ?> <div class="wrap wpl-wp user-wp"> <header> <div id="icon-user" class="icon48"> </div> <h2><?php echo __('User Manager', WPL_TEXTDOMAIN); ?> </h2> <?php if (wpl_global::check_addon('membership')) { ?> <a href="<?php echo wpl_global::add_qs_var('kind', wpl_flex::get_kind_id('user'), wpl_global::get_wpl_admin_menu('wpl_admin_flex')); ?> " class="setting-toolbar-btn button" title="<?php echo __('Manage User Data Structure', WPL_TEXTDOMAIN); ?> "><?php echo __('Manage User Data Structure', WPL_TEXTDOMAIN); ?> </a> <?php } ?> </header> <div class="wpl_user_list"><div class="wpl_show_message"></div></div> <div class="wpl-users-search-form"> <form method="GET" id="wpl_users_search_form">
private function enabled($dbst_id, $enabled_status) { $res = wpl_flex::update('wpl_dbst', $dbst_id, 'enabled', $enabled_status); $res = (int) $res; $message = $res ? __('Operation was successful.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN); $data = NULL; $response = array('success' => $res, 'message' => $message, 'data' => $data); echo json_encode($response); exit; }
/** * Updates property title * @author Howard <*****@*****.**> * @static * @param array $property_data * @param int $property_id * @param boolean $force * @return string */ public static function update_property_title($property_data, $property_id = 0, $force = false) { /** fetch property data if property id is setted **/ if ($property_id) { $property_data = self::get_property_raw_data($property_id); } if (!$property_id) { $property_id = $property_data['id']; } $column = 'field_313'; $field_id = wpl_flex::get_dbst_id($column, $property_data['kind']); $field = wpl_flex::get_field($field_id); $base_column = NULL; if (isset($field->multilingual) and $field->multilingual and wpl_global::check_multilingual_status()) { $base_column = wpl_global::get_current_language() == wpl_addon_pro::get_default_language() ? $column : NULL; $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false); } /** return current title if exists **/ if (isset($property_data[$column]) and trim($property_data[$column]) != '' and !$force) { return $property_data[$column]; } /** first validation **/ if (!$property_data) { return ''; } $listing_data = wpl_global::get_listings($property_data['listing']); $listing = isset($listing_data->name) ? $listing_data->name : ''; $property_type_data = wpl_global::get_property_types($property_data['property_type']); $property_type = isset($property_type_data->name) ? $property_type_data->name : ''; $title = array(); $title['property_type'] = __($property_type, WPL_TEXTDOMAIN); $title['listing'] = __($listing, WPL_TEXTDOMAIN); if ($property_data['kind']) { $kind_label = wpl_flex::get_kind_label($property_data['kind']); if (trim($kind_label)) { $title['kind'] = '(' . __($kind_label, WPL_TEXTDOMAIN) . ')'; } } $title_str = implode(' ', $title); /** apply filters **/ _wpl_import('libraries.filters'); @extract(wpl_filters::apply('generate_property_title', array('title' => $title, 'title_str' => $title_str))); /** update **/ if (wpl_db::columns('wpl_properties', $column)) { $query = "UPDATE `#__wpl_properties` SET `" . $column . "`='" . $title_str . "' WHERE `id`='" . $property_id . "'"; wpl_db::q($query, 'update'); } /** update **/ if ($base_column and wpl_db::columns('wpl_properties', $base_column)) { $query = "UPDATE `#__wpl_properties` SET `" . $base_column . "`='" . $title_str . "' WHERE `id`='" . $property_id . "'"; wpl_db::q($query, 'update'); } return $title_str; }
/** * Checke proeprty alias and 301 redirect the page to the correct link * @author Howard <*****@*****.**> * @param int $proeprty_id */ public function check_property_link($proeprty_id) { $wpl_qs = urldecode(wpl_global::get_wp_qvar('wpl_qs')); /** check property alias for avoiding duplicate content **/ $called_alias = $wpl_qs; $column = 'alias'; $field_id = wpl_flex::get_dbst_id($column, wpl_property::get_property_kind($proeprty_id)); $field = wpl_flex::get_field($field_id); if (isset($field->multilingual) and $field->multilingual and wpl_global::check_multilingual_status()) { $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false); } $property_alias = $proeprty_id . '-' . urldecode(wpl_db::get($column, 'wpl_properties', 'id', $proeprty_id)); if (trim($property_alias) != '' and $called_alias != $property_alias) { $url = wpl_sef::get_wpl_permalink(true) . '/' . urlencode($property_alias); header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $url); exit; } }
" name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo $instance['title']; ?> " onblur="wplSearchWidget<?php echo $this->number; ?> .saveChange(this);" /> </div> <div class="wpl-widget-row"> <?php $kinds = wpl_flex::get_kinds(''); ?> <label for="<?php echo $this->get_field_id('kind'); ?> "><?php echo __('Kind', WPL_TEXTDOMAIN); ?> </label> <select id="<?php echo $this->get_field_id('kind'); ?> " name="<?php echo $this->get_field_name('kind'); ?> "
?> </div> <?php } ?> <div class="panel-wp margin-top-1p"> <h3><?php echo __('Profile', WPL_TEXTDOMAIN); ?> </h3> <div class="panel-body"> <div class="pwizard-panel"> <div class="pwizard-section"> <?php $wpl_flex = new wpl_flex(); $wpl_flex->kind = $this->kind; $wpl_flex->generate_wizard_form($this->user_fields, $this->user_data, $this->user_data['id']); ?> </div> <div class="text-left finilize-btn"> <button class="wpl-button button-1" onclick="wpl_profile_finalize(<?php echo $this->user_data['id']; ?> );" id="wpl_profile_finalize_button" type="button" class="button button-primary"><?php echo __('Finalize', WPL_TEXTDOMAIN); ?> </button> <span id="wpl_profile_wizard_ajax_loader"></span> </div> </div>
public function display($instance = array()) { /** property listing model **/ $this->model = new wpl_users(); /** global settings **/ $settings = wpl_settings::get_settings(); /** listing settings **/ $this->page_number = wpl_request::getVar('wplpage', 1, '', true); $this->limit = wpl_request::getVar('limit', $settings['default_profile_page_size'], '', true); $this->start = wpl_request::getVar('start', ($this->page_number - 1) * $this->limit, '', true); $this->orderby = wpl_request::getVar('wplorderby', $settings['default_profile_orderby'], '', true); $this->order = wpl_request::getVar('wplorder', $settings['default_profile_order'], '', true); /** Set Property CSS class **/ $this->property_css_class = wpl_request::getVar('wplpcc', NULL); if (!$this->property_css_class) { $this->property_css_class = wpl_request::getVar('wplpcc', 'grid_box', 'COOKIE'); } $this->property_css_class_switcher = wpl_request::getVar('wplpcc_switcher', '1'); /** set page if start var passed **/ $this->page_number = $this->start / $this->limit + 1; wpl_request::setVar('wplpage', $this->page_number); /** detect kind **/ $this->kind = wpl_request::getVar('kind', 2); if (!in_array($this->kind, wpl_flex::get_valid_kinds())) { /** import message tpl **/ $this->message = __('Invalid Request!', WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message', false, true); } /** pagination types **/ $this->wplpagination = wpl_request::getVar('wplpagination', 'normal', '', true); wpl_request::setVar('wplpagination', $this->wplpagination); $where = array('sf_tmin_id' => 1, 'sf_select_access_public_profile' => 1, 'sf_select_expired' => 0); /** Add search conditions to the where **/ $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET')); $where = array_merge($vars, $where); /** start search **/ $this->model->start($this->start, $this->limit, $this->orderby, $this->order, $where); $this->model->total = $this->model->get_users_count(); /** validation for page_number **/ $this->total_pages = ceil($this->model->total / $this->limit); if ($this->page_number <= 0 or $this->page_number > $this->total_pages) { $this->model->start = 0; } /** run the search **/ $query = $this->model->query(); $profiles = $this->model->search(); /** finish search **/ $this->model->finish(); $plisting_fields = $this->model->get_plisting_fields(); $wpl_profiles = array(); foreach ($profiles as $profile) { $wpl_profiles[$profile->id] = $this->model->full_render($profile->id, $plisting_fields); } /** define current index **/ $wpl_profiles['current'] = array(); /** apply filters (This filter must place after all proccess) **/ _wpl_import('libraries.filters'); @extract(wpl_filters::apply('profile_listing_after_render', array('wpl_profiles' => $wpl_profiles))); $this->pagination = wpl_pagination::get_pagination($this->model->total, $this->limit, true); $this->wpl_profiles = $wpl_profiles; /** import tpl **/ return parent::render($this->tpl_path, $this->tpl, false, true); }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); ?> <div class="pwizard-section"> <?php $wpl_flex = new wpl_flex(); $wpl_flex->kind = $this->kind; $wpl_flex->generate_wizard_form($this->fields, $this->values, $this->property_id, $this->finds); ?> <?php /** including a custom file **/ $this->_wpl_import($this->tpl_path . '.custom.listing' . $this->field_category->id); ?> </div>
<?php /** no direct access * */ defined('_WPLEXEC') or die('Restricted access'); if ($type == 'parent' and !$done_this) { $kinds = wpl_flex::get_kinds('wpl_properties'); ?> <div class="fanc-body"> <div class="fanc-row fanc-button-row-2"> <span class="ajax-inline-save" id="wpl_dbst_modify_ajax_loader"></span> <input class="wpl-button button-1" type="button" onclick="save_dbst('<?php echo $__prefix; ?> ', <?php echo $dbst_id; ?> );" value="<?php echo __('Save', WPL_TEXTDOMAIN); ?> " id="wpl_dbst_submit_button" /> </div> <div class="col-wp"> <div class="col-fanc-left" id="wpl_flex_general_options"> <div class="fanc-row fanc-inline-title"> <?php echo __('General Options', WPL_TEXTDOMAIN); ?> </div> <?php /** include main file **/ include _wpl_import('libraries.dbst_modify.main.main', true, true);
public function build() { /** property listing model **/ $this->model = new wpl_property(); if (!in_array($this->kind, wpl_flex::get_valid_kinds())) { $this->error = "ERROR: Invalid property kind!"; return false; } $default_where = array('sf_select_confirmed' => 1, 'sf_select_finalized' => 1, 'sf_select_deleted' => 0, 'sf_select_expired' => 0, 'sf_select_kind' => $this->kind); $this->where = array_merge($default_where, $this->where); /** Add search conditions to the where **/ $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET')); $this->where = array_merge($vars, $this->where); /** start search **/ $this->model->start($this->start, $this->limit, $this->orderby, $this->order, $this->where); $this->model->total = $this->model->get_properties_count(); $this->built['listings']['total'] = $this->model->total; /** run the search **/ $query = $this->model->query(); $properties = $this->model->search(); /** finish search **/ $this->model->finish(); $plisting_fields = $this->model->get_plisting_fields(); foreach ($properties as $property) { $rendered = array(); $rendered = $this->model->full_render($property->id, $plisting_fields, $property); $rendered['property_id'] = $property->id; $items = $rendered['items']; /** render gallery **/ if ($this->pictures) { $rendered['images'] = wpl_items::render_gallery($items['gallery']); } /** render attachments **/ if ($this->attachments) { $rendered['attachments'] = wpl_items::render_attachments($items['attachment']); } /** render videos **/ if ($this->videos) { $rendered['videos'] = wpl_items::render_videos($items['video']); } /** render rooms **/ if ($this->rooms) { $rendered['rooms'] = $items['rooms']; } /** render gallery custom sizes **/ if (is_array($this->image_sizes)) { $rendered['custom_sizes'] = wpl_items::render_gallery_custom_sizes($property_id, $items['gallery'], $this->image_sizes); } /** render agent data **/ if ($this->agentinfo) { $rendered['agent'] = wpl_users::full_render($property->user_id); unset($rendered['agent']['data']); unset($rendered['agent']['items']); } unset($rendered['items']); $this->built['listings'][$property->id] = $rendered; } return $this->built; }
public function display($instance = array()) { /** check access **/ if (!wpl_users::check_access('propertylisting')) { /** 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'); $this->method = wpl_request::getVar('wplmethod', NULL); /** global settings **/ $this->settings = wpl_settings::get_settings(); /** listing settings **/ $this->page_number = wpl_request::getVar('wplpage', 1, '', true); $this->limit = wpl_request::getVar('limit', $this->settings['default_page_size']); $this->start = wpl_request::getVar('start', ($this->page_number - 1) * $this->limit, '', true); $this->orderby = wpl_request::getVar('wplorderby', $this->settings['default_orderby'], '', true); $this->order = wpl_request::getVar('wplorder', $this->settings['default_order'], '', true); /** Set Property CSS class **/ $this->property_css_class = !$this->wplraw ? wpl_request::getVar('wplpcc', NULL) : NULL; if (!$this->property_css_class) { $this->property_css_class = wpl_request::getVar('wplpcc', 'grid_box', 'COOKIE'); } $this->property_css_class_switcher = wpl_request::getVar('wplpcc_switcher', '1'); $this->property_listview = wpl_request::getVar('wplplv', '1'); #Show listview or not /** RSS Feed Setting **/ $this->listings_rss_enabled = isset($this->settings['listings_rss_enabled']) ? $this->settings['listings_rss_enabled'] : 0; /** detect kind **/ $this->kind = wpl_request::getVar('kind', 0); if (!$this->kind) { $this->kind = wpl_request::getVar('sf_select_kind', 0); } if (!in_array($this->kind, wpl_flex::get_valid_kinds())) { /** import message tpl **/ $this->message = __('Invalid Request!', WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message', false, true); } /** pagination types **/ $this->wplpagination = wpl_request::getVar('wplpagination', 'normal', '', true); wpl_request::setVar('wplpagination', $this->wplpagination); /** property listing model **/ $this->model = new wpl_property(); /** set page if start var passed **/ $this->page_number = $this->start / $this->limit + 1; wpl_request::setVar('wplpage', $this->page_number); $where = array('sf_select_confirmed' => 1, 'sf_select_finalized' => 1, 'sf_select_deleted' => 0, 'sf_select_expired' => 0, 'sf_select_kind' => $this->kind); /** Add search conditions to the where **/ $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET')); $where = array_merge($vars, $where); /** start search **/ $this->model->start($this->start, $this->limit, $this->orderby, $this->order, $where, $this->kind); $this->model->total = $this->model->get_properties_count(); /** validation for page_number **/ $this->total_pages = ceil($this->model->total / $this->limit); if ($this->page_number <= 0 or $this->page_number > $this->total_pages) { $this->model->start = 0; } /** run the search **/ $query = $this->model->query(); $properties = $this->model->search(); /** finish search **/ $this->model->finish(); $plisting_fields = $this->model->get_plisting_fields('', $this->kind); $wpl_properties = array(); foreach ($properties as $property) { $wpl_properties[$property->id] = $this->model->full_render($property->id, $plisting_fields, $property); } /** define current index **/ $wpl_properties['current'] = array(); /** 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->pagination = wpl_pagination::get_pagination($this->model->total, $this->limit, true, $this->wplraw); $this->wpl_properties = $wpl_properties; if ($this->wplraw and $this->method == 'get_markers') { $markers = array('markers' => $this->model->render_markers($wpl_properties), 'total' => $this->model->total); echo json_encode($markers); exit; } elseif ($this->wplraw and $this->method == 'get_listings') { if ($this->return_listings) { return $wpl_properties; } else { echo json_encode($wpl_properties); exit; } } /** 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); }
protected function include_tabs() { $this->kinds = wpl_flex::get_kinds(NULL); /** include the layout **/ parent::render($this->tpl_path, 'internal_tabs'); }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); /** set params **/ $wpl_properties = isset($params['wpl_properties']) ? $params['wpl_properties'] : array(); $property_id = isset($wpl_properties['current']['data']['id']) ? $wpl_properties['current']['data']['id'] : NULL; /** Kind **/ $this->kind = isset($wpl_properties['current']['data']['kind']) ? $wpl_properties['current']['data']['kind'] : 0; $kind_data = wpl_flex::get_kind($this->kind); /** Parameters **/ $this->params = $params; /** get params **/ $this->googlemap_type = isset($params['googlemap_type']) ? $params['googlemap_type'] : 0; $this->googlemap_view = isset($params['googlemap_view']) ? $params['googlemap_view'] : 'WPL'; $this->map_width = isset($params['map_width']) ? $params['map_width'] : 360; $this->map_height = isset($params['map_height']) ? $params['map_height'] : 385; $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'] : '14'; $this->infowindow_event = isset($params['infowindow_event']) ? $params['infowindow_event'] : 'click'; $this->overviewmap = isset($params['overviewmap']) ? $params['overviewmap'] : 0; $this->show_marker = (isset($kind_data['map']) and $kind_data['map'] != 'marker') ? 0 : 1; /* Get Google Place Option */ $this->google_place = isset($params['google_place']) ? $params['google_place'] : 0; $this->google_place_radius = isset($params['google_place_radius']) ? $params['google_place_radius'] : 1000; $this->markers = wpl_property::render_markers($wpl_properties); /** WPL Demographic addon **/ $this->demographic_objects = array(); if (wpl_global::check_addon('demographic')) { _wpl_import('libraries.addon_demographic');
<div class="active-block"> <!--All active fields will be here--> </div> <div class="wpl-inactive-block-wp wpl-util-scrollbar-wrap"> <div class="wpl-util-scrollbar-frame"> <div class="inactive-block"> <!--All inactive fields will be here--> </div> </div> <div class="wpl-util-scrollbar-scroll wpl-util-scrollbar-bottom"> <div class="wpl-util-scrollbar-handler"></div> </div> </div> <div class="all-block"> <?php wpl_search_widget::generate_backend_fields(wpl_flex::get_fields($category->id, 1, $this->kind, 'searchmod', 1), $values); ?> </div> <div class="overlay-wp"> <div class="overlay-text"> <?php echo __('Drag Here', WPL_TEXTDOMAIN); ?> </div> </div> </div>
} if (isset($options['if_zero']) and !$options['if_zero'] and !trim($value)) { $return = array(); } $done_this = true; } elseif ($type == 'mmprice' and !$done_this) { $return['field_id'] = $field->id; $return['type'] = $field->type; $return['name'] = __($field->name, WPL_TEXTDOMAIN); $rendered_price = wpl_render::render_price($value, $values[$field->table_column . '_unit']); if (trim($values[$field->table_column . '_max'])) { $rendered_price .= ' - ' . wpl_render::render_price($values[$field->table_column . '_max'], $values[$field->table_column . '_unit']); } $return['value'] = $rendered_price; $return['price_only'] = $rendered_price; $price_period = wpl_property::render_field($values['price_period'], wpl_flex::get_dbst_id('price_period', $field->kind)); if (isset($price_period['value'])) { $return['value'] .= ' ' . $price_period['value']; $return['price_period'] = $price_period['value']; } if (isset($options['if_zero']) and $options['if_zero'] == 2 and !trim($value) and !trim($values[$field->table_column . '_max'])) { $return['value'] = __($options['call_text'], WPL_TEXTDOMAIN); } if (isset($options['if_zero']) and !$options['if_zero'] and !trim($value) and !trim($values[$field->table_column . '_max'])) { $return = array(); } $done_this = true; } elseif ($type == 'url' and !$done_this) { if (trim($value) != '') { $return['field_id'] = $field->id; $return['type'] = $field->type;
/** * Generate location text of User * @author Howard R <*****@*****.**> * @static * @param array $user_data * @param int $user_id * @param string $glue * @return string */ public static function generate_location_text($user_data, $user_id = 0, $glue = ',') { /** fetch user data if user id is setted **/ if ($user_id) { $user_data = (array) wpl_users::get_wpl_user($user_id); } if (!$user_id) { $user_id = $user_data['id']; } $locations = array(); if (isset($user_data['location7_name']) and trim($user_data['location7_name']) != '') { $locations['location7_name'] = __($user_data['location7_name'], WPL_TEXTDOMAIN); } if (isset($user_data['location6_name']) and trim($user_data['location6_name']) != '') { $locations['location6_name'] = __($user_data['location6_name'], WPL_TEXTDOMAIN); } if (isset($user_data['location5_name']) and trim($user_data['location5_name']) != '') { $locations['location5_name'] = __($user_data['location5_name'], WPL_TEXTDOMAIN); } if (isset($user_data['location4_name']) and trim($user_data['location4_name']) != '') { $locations['location4_name'] = __($user_data['location4_name'], WPL_TEXTDOMAIN); } if (isset($user_data['location3_name']) and trim($user_data['location3_name']) != '') { $locations['location3_name'] = __($user_data['location3_name'], WPL_TEXTDOMAIN); } if (isset($user_data['location2_name']) and trim($user_data['location2_name']) != '') { $locations['location2_name'] = __($user_data['location2_name'], WPL_TEXTDOMAIN); } if (isset($user_data['zip_name']) and trim($user_data['zip_name']) != '') { $locations['zip_name'] = __($user_data['zip_name'], WPL_TEXTDOMAIN); } if (isset($user_data['location1_name']) and trim($user_data['location1_name']) != '') { $locations['location1_name'] = __($user_data['location1_name'], WPL_TEXTDOMAIN); } $location_pattern = wpl_global::get_setting('user_location_pattern'); if (trim($location_pattern) == '') { $location_pattern = '[location5_name][glue][location4_name][glue][location3_name][glue][location2_name][glue][location1_name] [zip_name]'; } $location_text = ''; $location_text = isset($locations['location7_name']) ? str_replace('[location7_name]', $locations['location7_name'], $location_pattern) : str_replace('[location7_name]', '', $location_pattern); $location_text = isset($locations['location6_name']) ? str_replace('[location6_name]', $locations['location6_name'], $location_pattern) : str_replace('[location6_name]', '', $location_pattern); $location_text = isset($locations['location5_name']) ? str_replace('[location5_name]', $locations['location5_name'], $location_pattern) : str_replace('[location5_name]', '', $location_pattern); $location_text = isset($locations['location4_name']) ? str_replace('[location4_name]', $locations['location4_name'], $location_text) : str_replace('[location4_name]', '', $location_text); $location_text = isset($locations['location3_name']) ? str_replace('[location3_name]', $locations['location3_name'], $location_text) : str_replace('[location3_name]', '', $location_text); $location_text = isset($locations['location2_name']) ? str_replace('[location2_name]', $locations['location2_name'], $location_text) : str_replace('[location2_name]', '', $location_text); $location_text = isset($locations['zip_name']) ? str_replace('[zip_name]', $locations['zip_name'], $location_text) : str_replace('[zip_name]', '', $location_text); $location_text = isset($locations['location1_name']) ? str_replace('[location1_name]', $locations['location1_name'], $location_text) : str_replace('[location1_name]', '', $location_text); $location_text = str_replace('[glue]', $glue, $location_text); /** apply filters **/ _wpl_import('libraries.filters'); @extract(wpl_filters::apply('generate_user_location_text', array('location_text' => $location_text, 'glue' => $glue, 'user_data' => $user_data))); $final = ''; $ex = explode($glue, $location_text); foreach ($ex as $value) { if (trim($value) == '') { continue; } $final .= trim($value) . $glue . ' '; } $location_text = trim($final, $glue . ' '); $column = 'location_text'; $field_id = wpl_flex::get_dbst_id($column, 2); $field = wpl_flex::get_field($field_id); if (isset($field->multilingual) and $field->multilingual and wpl_global::check_multilingual_status()) { $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false); } /** update **/ $query = "UPDATE `#__wpl_users` SET `{$column}`='" . $location_text . "' WHERE `id`='{$user_id}'"; wpl_db::q($query, 'update'); return $location_text; }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); /** set params **/ $wpl_properties = isset($params['wpl_properties']) ? $params['wpl_properties'] : array(); $property_id = isset($wpl_properties['current']['data']['id']) ? $wpl_properties['current']['data']['id'] : NULL; /** Kind **/ $kind = isset($wpl_properties['current']['data']['kind']) ? $wpl_properties['current']['data']['kind'] : 0; $kind_data = wpl_flex::get_kind($kind); /** Parameters **/ $this->params = $params; /** get params **/ $this->googlemap_type = isset($params['googlemap_type']) ? $params['googlemap_type'] : 0; $this->googlemap_view = isset($params['googlemap_view']) ? $params['googlemap_view'] : 'WPL'; $this->map_width = isset($params['map_width']) ? $params['map_width'] : 360; $this->map_height = isset($params['map_height']) ? $params['map_height'] : 385; $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'] : '14'; $this->infowindow_event = isset($params['infowindow_event']) ? $params['infowindow_event'] : 'click'; $this->overviewmap = isset($params['overviewmap']) ? $params['overviewmap'] : 0; $this->show_marker = (isset($kind_data['map']) and $kind_data['map'] != 'marker') ? 0 : 1; /* Get Google Place Option */ $this->google_place = isset($params['google_place']) ? $params['google_place'] : 0; $this->google_place_radius = isset($params['google_place_radius']) ? $params['google_place_radius'] : 1000; $this->markers = wpl_property::render_markers($wpl_properties); /** WPL Demographic addon **/ $this->demographic_objects = array(); if (wpl_global::check_addon('demographic')) { _wpl_import('libraries.addon_demographic');