public function start($layout, $params) { $room_types = wpl_global::return_in_id_array(wpl_room_types::get_room_types()); /** include layout **/ $layout_path = _wpl_import($layout, true, true); include $layout_path; }
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); }
/** * Use this function for applying any filter * @author Howard <*****@*****.**> * @param string $trigger * @param array $params * @return mixed */ public static function apply($trigger, $params = array()) { /** fetch filters **/ $filters = self::get_filters($trigger, 1); if (count($filters) == 0) { return $params; } foreach ($filters as $filter) { /** generate all params **/ $all_params = array(); $all_params[0] = $params; $all_params[1] = json_decode($filter->params, true); $all_params[2] = $filter; /** import class **/ $path = _wpl_import($filter->class_location, true, true); if (!wpl_file::exists($path)) { continue; } include_once $path; /** call function **/ $filter_obj = new $filter->class_name(); $params = call_user_func(array($filter_obj, $filter->function_name), $all_params); } return $params; }
/** * 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) . "\");")); } } } } }
private function shortcode_wizard() { _wpl_import('libraries.sort_options'); /** global settings **/ $this->settings = wpl_global::get_settings(); parent::render($this->tpl_path, 'shortcode_wizard'); }
public function start($layout, $params) { wpl_extensions::import_javascript((object) array('param1' => 'wpl-jqplot', 'param2' => 'packages/jqplot/jquery.jqplot.min.js')); wpl_extensions::import_style((object) array('param1' => 'wpl-jqplot', 'param2' => 'packages/jqplot/jquery.jqplot.min.css')); $params['unique_chart_id'] = md5(uniqid(time() . mt_rand(0, mt_getrandmax()), true)); /** include layout **/ $layout_path = _wpl_import($layout, true, true); include $layout_path; }
/** * Constructor method * @author Howard <*****@*****.**> * @param string $format */ public function __construct($format) { $this->_wpl_request_format = $format; $ex = explode(':', $this->_wpl_request_format); $this->_wpl_client = array_search($this->_wpl_clients[$ex[0]], $this->_wpl_clients) ? $this->_wpl_clients[$ex[0]] : 'frontend'; $this->_wpl_folder = $ex[1]; $this->_wpl_file = $this->get_file_name($ex[2]); $this->_wpl_plugin = isset($ex[3]) ? $ex[3] : ''; $this->_wpl_class = $this->get_class_name($ex); /** import file **/ _wpl_import($this->get_class_path()); }
public function show_tips() { $page = wpl_request::getVar('page', ''); /** First Validation **/ if (!trim($page)) { return false; } $tips = array(); $path = _wpl_import('assets.tips.' . $page, true, true); if (wpl_file::exists($path)) { $tips = (include_once $path); } /** Generate script **/ $this->generate_scripts($tips); }
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); }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); include _wpl_import('widgets.carousel.scripts.js', true, true); $image_width = isset($this->instance['data']['image_width']) ? $this->instance['data']['image_width'] : 1920; $image_height = isset($this->instance['data']['image_height']) ? $this->instance['data']['image_height'] : 558; $tablet_image_height = isset($this->instance['data']['tablet_image_height']) ? $this->instance['data']['tablet_image_height'] : 400; $phone_image_height = isset($this->instance['data']['phone_image_height']) ? $this->instance['data']['phone_image_height'] : 310; $thumbnail_width = isset($this->instance['data']['thumbnail_width']) ? $this->instance['data']['thumbnail_width'] : 150; $thumbnail_height = isset($this->instance['data']['thumbnail_height']) ? $this->instance['data']['thumbnail_height'] : 60; $auto_play = isset($this->instance['data']['auto_play']) ? $this->instance['data']['auto_play'] : true; $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 {
?> <?php echo $this->css_class; ?> "> <!-- Do not change the ID --> <div id="wpl_searchwidget_<?php echo $widget_id; ?> " class="clearfix"> <div class="wpl_search_from"> <?php foreach ($this->rendered as $data) { echo '<div class="wpl_search_feilds ' . $data['field_data']['type'] . '">' . $data['html'] . '</div>'; } ?> <div class="search_submit_box"> <input id="wpl_search_widget_submit<?php echo $widget_id; ?> " class="wpl_search_widget_submit" type="submit" value="<?php echo __('Search', WPL_TEXTDOMAIN); ?> " /> </div> </div> </div> </form> <?php include _wpl_import('widgets.search.scripts.js', true, true);
/** * Updates locationtextsearch data. It runes by WPL cronjob! * @author Howard <*****@*****.**> * @static */ public static function update_locationtextsearch_data() { /** detele wpl_locationtextsearch completely **/ wpl_db::q("DELETE FROM `#__wpl_locationtextsearch`"); /** Don't run in case of many listings **/ if (wpl_db::num('', 'wpl_properties') > 2500) { wpl_db::q("UPDATE `#__wpl_cronjobs` SET `enabled`='0' WHERE `id`='1'"); return false; } _wpl_import('libraries.property'); $properties = wpl_property::select_active_properties('', '`id`,`location1_name`,`location2_name`,`location3_name`,`location4_name`,`location5_name`,`location6_name`,`location7_name`,`zip_name`'); $locations = array(); foreach ($properties as $property) { $pid = $property['id']; $locations[$pid] = array(); $locations[$pid]['full_location'] = ''; $locations[$pid]['zip'] = ''; for ($j = 1; $j <= 7; $j++) { $locations[$pid][$j] = ''; } for ($i = 7; $i >= 1; $i--) { $locations[$pid]['full_location'] .= ', ' . $property['location' . $i . '_name']; if ($i <= 7 and trim($property['location7_name'])) { $locations[$pid]['7'] .= ', ' . $property['location' . $i . '_name']; } if ($i <= 6 and trim($property['location6_name'])) { $locations[$pid]['6'] .= ', ' . $property['location' . $i . '_name']; } if ($i <= 5 and trim($property['location5_name'])) { $locations[$pid]['5'] .= ', ' . $property['location' . $i . '_name']; } if ($i <= 4 and trim($property['location4_name'])) { $locations[$pid]['4'] .= ', ' . $property['location' . $i . '_name']; } if ($i <= 3 and trim($property['location3_name'])) { $locations[$pid]['3'] .= ', ' . $property['location' . $i . '_name']; } if ($i <= 2 and trim($property['location2_name'])) { $locations[$pid]['2'] .= ', ' . $property['location' . $i . '_name']; } if ($i <= 1 and trim($property['location1_name'])) { $locations[$pid]['1'] .= ', ' . $property['location' . $i . '_name']; } } /** remove extra , and spaces if any **/ foreach ($locations[$pid] as $key => $location) { $locations[$pid][$key] = trim($location, ', '); } /** add zip code **/ $locations[$pid]['zip'] = $property['zip_name'] . ', ' . $locations[$pid]['full_location']; } /** make a new location array **/ $unique_locations = array(); foreach ($locations as $pid => $location) { foreach ($location as $location_level => $location_string) { $unique_locations[] = $location_string; } } $unique_locations = array_unique($unique_locations); foreach ($unique_locations as $location_text) { $query = "SELECT `kind`, COUNT(id) AS count FROM `#__wpl_properties` WHERE `deleted`='0' AND `finalized`='1' AND `confirmed`='1' AND `expired`='0' AND `location_text` LIKE '%" . wpl_db::escape($location_text) . "%' GROUP BY `kind`"; $counts = wpl_db::select($query, 'loadAssocList'); $total_count = 0; foreach ($counts as $count) { $total_count += $count['count']; } /** add to wpl_locationtextsearch **/ $query = "INSERT INTO `#__wpl_locationtextsearch` (`location_text`,`count`,`counts`) VALUES ('" . wpl_db::escape($location_text) . "','{$total_count}','" . json_encode($counts) . "')"; wpl_db::q($query); } }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); _wpl_import('libraries.pagination'); _wpl_import('libraries.sort_options'); class wpl_data_structure_controller extends wpl_controller { public $tpl_path = 'views.backend.data_structure.tmpl'; public $tpl; public function display() { /** check permission **/ wpl_global::min_access('administrator'); $function = wpl_request::getVar('wpl_function'); if ($function == 'sort_options') { $sort_ids = wpl_request::getVar('sort_ids'); self::sort_options($sort_ids); } elseif ($function == 'sort_options_enabled_state_change') { $id = wpl_request::getVar('id'); $enabled_status = wpl_request::getVar('enabled_status'); self::update('wpl_sort_options', $id, 'enabled', $enabled_status); } elseif ($function == 'save_sort_option') { $id = wpl_request::getVar('id'); $sort_name = wpl_request::getVar('sort_name', ''); self::update('wpl_sort_options', $id, 'name', $sort_name); } } /** *{tablename,id,key,value of key} * this function call update function in units library and change value of a field
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); }
<li class="report_abuse_link"> <a data-realtyna-lightbox href="#wpl_pshow_lightbox_content_container" onclick="return wpl_report_abuse_get_form(<?php echo $property_id; ?> );"><?php echo __('Report Abuse', WPL_TEXTDOMAIN); ?> </a> </li> <?php } ?> <?php if ($show_crm) { _wpl_import('libraries.addon_crm'); $crm = new wpl_addon_crm(); ?> <li class="crm_link"> <a href="<?php echo $crm->URL('form'); ?> &pid=<?php echo $property_id; ?> " target="_blank"><?php echo __('Contact for this Property', WPL_TEXTDOMAIN); ?> </a> </li> <?php
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); _wpl_import('libraries.locations'); _wpl_import('libraries.pagination'); _wpl_import('libraries.settings'); class wpl_location_manager_controller extends wpl_controller { public $tpl_path = 'views.backend.location_manager.tmpl'; public $tpl; public function home() { /** check permission **/ wpl_global::min_access('administrator'); $this->level = trim(wpl_request::getVar('level')) != '' ? wpl_request::getVar('level') : 1; $this->parent = trim(wpl_request::getVar('sf_select_parent')) != '' ? wpl_request::getVar('sf_select_parent') : ""; $this->enabled = trim(wpl_request::getVar('sf_select_enabled')) != '' ? wpl_request::getVar('sf_select_enabled') : 1; $this->text_search = trim(wpl_request::getVar('sf_text_name')) != '' ? wpl_request::getVar('sf_text_name') : ''; $this->admin_url = wpl_global::get_wp_admin_url(); $this->load_zipcodes = trim(wpl_request::getVar('load_zipcodes')) != '' ? 1 : 0; /** set show all based on level **/ if ($this->level != 1) { $this->enabled = ''; } $possible_orders = array('id', 'name'); $orderby = in_array(wpl_request::getVar('orderby'), $possible_orders) ? wpl_request::getVar('orderby') : $possible_orders[0]; $order = in_array(strtoupper(wpl_request::getVar('order')), array('ASC', 'DESC')) ? wpl_request::getVar('order') : 'ASC'; $page_size = trim(wpl_request::getVar('page_size')) != '' ? wpl_request::getVar('page_size') : NULL; /** create where **/ $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET'));
<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); ?> </div> </div> </div> <?php $done_this = true; }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); _wpl_import('views.frontend.property_listing.wpl_abstract'); class wpl_property_listing_controller extends wpl_property_listing_controller_abstract { public $wplraw = 0; }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); _wpl_import('views.frontend.property_show.wpl_abstract'); class wpl_property_show_controller extends wpl_property_show_controller_abstract { public $wplraw = 1; }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); /** set params **/ $wpl_profiles = isset($params['wpl_profiles']) ? $params['wpl_profiles'] : array(); $this->user_id = isset($params['user_id']) ? $params['user_id'] : NULL; $this->user_id = isset($wpl_properties['current']['data']['id']) ? $wpl_properties['current']['data']['id'] : $this->user_id; $this->top_comment = isset($params['top_comment']) ? $params['top_comment'] : ''; include_once _wpl_import($this->tpl_path . '.scripts.js', true, true); ?> <div class="wpl_contact_container wpl_user_contact_container" id="wpl_user_contact_container<?php echo $this->user_id; ?> "> <?php if (trim($this->top_comment) != '') { ?> <p class="wpl_contact_comment"><?php echo $this->top_comment; ?> </p> <?php } ?> <form method="post" action="#" id="wpl_user_contact_form<?php echo $this->user_id; ?> " onsubmit="return wpl_send_user_contact(<?php echo $this->user_id; ?>
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); _wpl_import('libraries.notifications.notifications'); class wpl_notifications_controller extends wpl_controller { public $tpl_path = 'views.backend.notifications.tmpl'; public $tpl; public function home() { /** check permission **/ wpl_global::min_access('administrator'); $this->tpl = wpl_request::getVar('tpl', 'default'); if ($this->tpl == 'modify') { $this->id = wpl_request::getVar('id', 0); $this->modify(); } else { $this->notifications = wpl_notifications::get_notifications(); parent::render($this->tpl_path, $this->tpl); } } public function modify() { $this->notification = wpl_notifications::get_notifications("AND `id`='" . wpl_db::escape($this->id) . "'", 'loadObject'); $this->additional_memberships = explode(',', $this->notification->additional_memberships); $this->additional_users = explode(',', $this->notification->additional_users); $this->additional_emails = explode(',', $this->notification->additional_emails); $this->users = wpl_users::get_wpl_users(); $this->memberships = wpl_users::get_wpl_memberships(); $this->memberships_array = self::unset_additional_receipts($this->additional_memberships, $this->memberships);
?> </div> <?php /** include main file **/ include _wpl_import('libraries.dbst_modify.main.main', true, true); ?> </div> <div class="col-fanc-right" id="wpl_flex_specific_options"> <div class="fanc-row fanc-inline-title"> <?php echo __('Specific Options', WPL_TEXTDOMAIN); ?> </div> <?php /** include specific file **/ include _wpl_import('libraries.dbst_modify.main.' . ($kind == 2 ? 'user' : '') . 'specific', true, true); ?> <div class="fanc-row fanc-inline-title"> <span> <?php echo __('Params', WPL_TEXTDOMAIN); ?> </span> </div> <div class="fanc-row"> <label for="<?php echo $__prefix; ?> opt_ext_file"><?php echo __('Valid file type', WPL_TEXTDOMAIN);
/** * Running installation queries and initializing WPL * @author Howard <*****@*****.**> * @return void */ public function activate_wpl() { if (wpl_folder::exists(WPL_ABSPATH . 'assets' . DS . 'install' . DS . 'files')) { /** copy files **/ $res = wpl_folder::copy(WPL_ABSPATH . 'assets' . DS . 'install' . DS . 'files', ABSPATH, '', true); /** delete files **/ wpl_folder::delete(WPL_ABSPATH . 'assets' . DS . 'install' . DS . 'files'); } /** run queries **/ $query_file = WPL_ABSPATH . 'assets' . DS . 'install' . DS . 'queries.sql'; if (wpl_file::exists($query_file)) { $queries = wpl_file::read($query_file); $queries = str_replace(";\r\n", "-=++=-", $queries); $queries = str_replace(";\r", "-=++=-", $queries); $queries = str_replace(";\n", "-=++=-", $queries); $sqls = explode("-=++=-", $queries); if (function_exists('is_multisite') and is_multisite() and wpl_global::check_addon('multisite')) { $original_blog_id = wpl_global::get_current_blog_id(); // Get all blogs $blogs = wpl_db::select("SELECT `blog_id` FROM `#__blogs`", 'loadColumn'); foreach ($blogs as $blog) { if (!isset($blog->blog_id)) { continue; } switch_to_blog($blog->blog_id); foreach ($sqls as $sql) { try { wpl_db::q($sql); } catch (Exception $e) { } } } /** delete query file **/ wpl_file::delete($query_file); switch_to_blog($original_blog_id); } else { foreach ($sqls as $sql) { try { wpl_db::q($sql); } catch (Exception $e) { } } /** delete query file **/ wpl_file::delete($query_file); } } /** run script **/ $script_file = WPL_ABSPATH . 'assets' . DS . 'install' . DS . 'script.php'; if (wpl_file::exists($script_file)) { include $script_file; /** delete script file **/ wpl_file::delete($script_file); } if (function_exists('is_multisite') and is_multisite() and wpl_global::check_addon('multisite')) { $original_blog_id = wpl_global::get_current_blog_id(); // Get all blogs $blogs = wpl_db::select("SELECT `blog_id` FROM `#__blogs`", 'loadColumn'); foreach ($blogs as $blog) { if (!isset($blog->blog_id)) { continue; } switch_to_blog($blog->blog_id); /** create propertylisting page **/ $pages = array('Properties' => '[WPL]', 'For Sale' => '[WPL sf_select_listing="9"]', 'For Rent' => '[WPL sf_select_listing="10"]', 'Vacation Rental' => '[WPL sf_select_listing="12"]'); foreach ($pages as $title => $content) { if (wpl_db::select("SELECT COUNT(post_content) FROM `#__posts` WHERE `post_content` LIKE '%{$content}%' AND `post_status` IN ('publish', 'private')", 'loadResult') != 0) { continue; } $post = array('post_title' => $title, 'post_content' => $content, 'post_type' => 'page', 'post_status' => 'publish', 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_author' => 1); $post_id = wp_insert_post($post); if ($content == '[WPL]') { _wpl_import('libraries.settings'); wpl_settings::save_setting('main_permalink', $post_id); } } /** Add admin user to WPL **/ wpl_users::add_user_to_wpl(1); } switch_to_blog($original_blog_id); } else { /** create propertylisting page **/ $pages = array('Properties' => '[WPL]', 'For Sale' => '[WPL sf_select_listing="9"]', 'For Rent' => '[WPL sf_select_listing="10"]', 'Vacation Rental' => '[WPL sf_select_listing="12"]'); foreach ($pages as $title => $content) { if (wpl_db::select("SELECT COUNT(post_content) FROM `#__posts` WHERE `post_content` LIKE '%{$content}%' AND `post_status` IN ('publish', 'private')", 'loadResult') != 0) { continue; } $post = array('post_title' => $title, 'post_content' => $content, 'post_type' => 'page', 'post_status' => 'publish', 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_author' => 1); $post_id = wp_insert_post($post); if ($content == '[WPL]') { _wpl_import('libraries.settings'); wpl_settings::save_setting('main_permalink', $post_id); } } /** Add admin user to WPL **/ wpl_users::add_user_to_wpl(1); } /** upgrade WPL **/ self::upgrade_wpl(); }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); _wpl_import('libraries.flex'); class wpl_flex_controller extends wpl_controller { public $tpl_path = 'views.backend.flex.tmpl'; public $tpl; public function home() { /** check permission **/ wpl_global::min_access('administrator'); $this->kind = trim(wpl_request::getVar('kind')) != '' ? wpl_request::getVar('kind') : 0; if (!in_array($this->kind, wpl_flex::get_valid_kinds())) { $this->message = __('Invalid Kind!', WPL_TEXTDOMAIN); /** import tpl **/ return parent::render($this->tpl_path, 'message'); } $this->field_categories = wpl_flex::get_categories(0, $this->kind); $this->kind_label = wpl_flex::get_kind_label($this->kind); $this->dbst_types = wpl_flex::get_dbst_types(1, $this->kind); $this->new_dbst_id = wpl_flex::get_new_dbst_id(); /** import tpl **/ parent::render($this->tpl_path, $this->tpl); } protected function generate_slide($category) { $tpl = 'internal_slide'; $this->fields = wpl_flex::get_fields($category->id, 0, $this->kind, 'flex', 1); $this->field_category = $category;
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); _wpl_import($this->tpl_path . '.scripts.css'); ?> <div class="wrap wpl-wp data-structure-wp"> <header> <div id="icon-data-structure" class="icon48"></div> <h2><?php echo __('Data Structure Manager', WPL_TEXTDOMAIN); ?> </h2> </header> <div class="wpl_data_structure_list"><div class="wpl_show_message"></div></div> <div class="sidebar-wp"> <div class="side-2 side-tabs-wp"> <ul> <li> <a href="#property_types" class="wpl_slide_label wpl_slide_label_id_property_types" id="wpl_slide_label_id_property_types" onclick="rta.internal.slides.open('_property_types', '.side-tabs-wp', '.wpl_slide_container', 'currentTab');"> <?php echo __('Property Types', WPL_TEXTDOMAIN); ?> </a> </li> <li> <a href="#listing_types" class="wpl_slide_label wpl_slide_label_id_listing_types" id="wpl_slide_label_id_listing_types" onclick="rta.internal.slides.open('_listing_types', '.side-tabs-wp', '.wpl_slide_container', 'currentTab');"> <?php echo __('Listing Types', WPL_TEXTDOMAIN); ?>
public function start($layout, $params) { /** include layout **/ $layout_path = _wpl_import($layout, true, true); include $layout_path; }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); _wpl_import('libraries.flex'); _wpl_import('libraries.property'); _wpl_import('libraries.locations'); _wpl_import('libraries.render'); _wpl_import('libraries.items'); class wpl_listing_controller extends wpl_controller { public $tpl_path = 'views.backend.listing.tmpl'; public $tpl; public function display() { /** check permission **/ wpl_global::min_access('agent'); $function = wpl_request::getVar('wpl_function'); if ($function == 'save') { $table_name = wpl_request::getVar('table_name'); $table_column = wpl_request::getVar('table_column'); $value = wpl_request::getVar('value'); $item_id = wpl_request::getVar('item_id'); self::save($table_name, $table_column, $value, $item_id); } elseif ($function == 'location_save') { $table_name = wpl_request::getVar('table_name'); $table_column = wpl_request::getVar('table_column'); $value = wpl_request::getVar('value'); $item_id = wpl_request::getVar('item_id'); self::location_save($table_name, $table_column, $value, $item_id); } elseif ($function == 'get_locations') {
<div class="rt-same-height sidebar-float"> <!-- Generating addons --> <?php $this->generate_addons(); ?> <div class="side-4 side-changes js-full-height" data-minuse-size="56"> <div class="panel-wp"> <h3><?php echo __('Changelog', WPL_TEXTDOMAIN); ?> </h3> <div class="panel-body"> <?php _wpl_import('assets.changelogs.wpl'); ?> </div> </div> </div> </div> <!-- Generating statistic section --> <?php $this->announce(); ?> <div class="rt-same-height sidebar-float"> <!-- Generating statistic section --> <?php $this->statistic();
/** * 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; }
/** * Generates modify form of a dbst field * @author Howard R <*****@*****.**> * @static * @param string $dbst_type * @param int $dbst_id * @param int $kind * @return void */ public static function generate_modify_form($dbst_type = 'text', $dbst_id = 0, $kind = 0) { /** first validation **/ if (!$dbst_type) { return; } $dbst_data = $dbst_id != 0 ? self::get_field($dbst_id) : new stdClass(); $done_this = false; $type = $dbst_type; $values = $dbst_data; $options = isset($values->options) ? json_decode($values->options, true) : array(); $__prefix = 'wpl_flex_modify'; _wpl_import('libraries.listing_types'); _wpl_import('libraries.property_types'); $dbcats = self::get_categories(0, $kind); $listings = wpl_listing_types::get_listing_types(); $property_types = wpl_property_types::get_property_types(); $user_types = wpl_users::get_user_types(1, 'loadAssocList'); $memberships = wpl_users::get_wpl_memberships(); /** get files **/ $dbst_modifypath = WPL_ABSPATH . DS . 'libraries' . DS . 'dbst_modify'; $files = array(); if (wpl_folder::exists($dbst_modifypath)) { $files = wpl_folder::files($dbst_modifypath, '.php$'); foreach ($files as $file) { include $dbst_modifypath . DS . $file; } if (!$done_this) { /** include default file **/ include _wpl_import('libraries.dbst_modify.main.default', true, true); } } }