public static function save_external_images() { $kind = wpl_request::getVar('kind', 0); $pid = wpl_request::getVar('pid'); $links_str = wpl_request::getVar('links', ''); $type = wpl_request::getVar('type', 'gallery'); $category = wpl_request::getVar('category', 'external'); $links_str = str_replace(";", '<-->', $links_str); $links_str = str_replace(",", '<-->', $links_str); $links_str = str_replace("\r\n", '<-->', $links_str); $links_str = str_replace("\n", '<-->', $links_str); $links = explode('<-->', $links_str); foreach ($links as $link) { $link = trim($link, ',; '); if (trim($link) == '') { continue; } // get item category with first index $index = floatval(wpl_items::get_maximum_index($pid, $type, $kind, $category)) + 1.0; $name = 'external_image' . $index; $item = array('parent_id' => $pid, 'parent_kind' => $kind, 'item_type' => $type, 'item_cat' => $category, 'item_name' => $name, 'creation_date' => date("Y-m-d H:i:s"), 'index' => $index, 'item_extra3' => $link); $item_id = wpl_items::save($item); } exit; }
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); }
public static function delete_room() { $item_id = wpl_request::getVar('item_id'); /** deleting the room **/ if ($item_id != -1) { $result = wpl_items::delete($item_id); } $res = (int) $result; $message = $res ? __('Deleted.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN); $data = $item_id; $response = array('success' => $res, 'message' => $message, 'data' => $data); echo json_encode($response); exit; }
public function build() { $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; } $items = wpl_items::get_items($this->pid, '', $property['kind'], '', 1); /** render gallery **/ $images = wpl_items::render_gallery($items['gallery']); $this->built['listing']['images'] = $images; return $this->built; }
wpl_global::import_activity('ajax_file_upload:' . $activity_layout, '', $upload_params); ?> <span id="wpl_upload_saved_span_<?php echo $field->id; ?> " class="wpl_listing_saved_span"></span> <?php if ($options['preview'] and trim($value) != '') { ?> <div class="upload-preview-wp preview_upload" id="preview_upload<?php echo $field->id; ?> "> <div class="upload-preview"> <img src="<?php echo wpl_items::get_folder($item_id, $field->kind) . $value; ?> " /> <div class="preview-remove-button"> <span class="action-btn icon-recycle" onclick="wpl_remove_upload<?php echo $field->id; ?> ();"></span> </div> </div> </div> <script type="text/javascript"> function wpl_remove_upload<?php echo $field->id; ?> ()
private function delete_file($field_id, $user_id, $output = true) { $field_data = (array) wpl_db::get('*', 'wpl_dbst', 'id', $field_id); $user_data = (array) wpl_users::get_wpl_user($user_id); $path = wpl_items::get_path($user_id, $field_data['kind']) . $user_data[$field_data['table_column']]; /** delete file and reset db **/ wpl_file::delete($path); wpl_db::set('wpl_users', $user_id, $field_data['table_column'], ''); /** delete thumbnails **/ wpl_users::remove_thumbnails($user_id); /** called from other functions (upload function) **/ if (!$output) { return; } $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; }
private function item_save() { $kind = wpl_request::getVar('kind', 0); $parent_id = wpl_request::getVar('item_id', 0); $item_type = wpl_request::getVar('item_type', ''); $item_cat = wpl_request::getVar('item_cat', ''); $item_name = wpl_request::getVar('value', ''); $item_extra1 = wpl_request::getVar('item_extra1', ''); $item_extra2 = wpl_request::getVar('item_extra2', ''); $item_extra3 = wpl_request::getVar('item_extra3', ''); $query = "SELECT `id` FROM `#__wpl_items` WHERE `parent_kind`='{$kind}' AND `parent_id`='{$parent_id}' AND `item_type`='{$item_type}' AND `item_cat`='{$item_cat}'"; $item_id = wpl_db::select($query, 'loadResult'); $item = array('parent_id' => $parent_id, 'parent_kind' => $kind, 'item_type' => $item_type, 'item_cat' => $item_cat, 'item_name' => $item_name, 'creation_date' => date("Y-m-d H:i:s"), 'index' => '1.00', 'item_extra1' => $item_extra1, 'item_extra2' => $item_extra2, 'item_extra3' => $item_extra3); wpl_items::save($item, $item_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; }
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()) { /** 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); }
/** * 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; }
/** * Creates profile image * @author Howard <*****@*****.**> * @param string $source * @param int $width * @param int $height * @param array $params * @param int $watermark * @param int $rewrite * @param int $crop * description: resize and watermark images specially */ public static function create_profile_images($source, $width, $height, $params, $watermark = 0, $rewrite = 0, $crop = '') { /** first validation **/ if (!trim($source)) { return NULL; } $image_name = wpl_file::stripExt($params['image_name']); $image_ext = wpl_file::getExt($params['image_name']); $resized_image_name = 'th' . $image_name . '_' . $width . 'x' . $height . '.' . $image_ext; $image_dest = wpl_items::get_path($params['image_parentid'], 2) . $resized_image_name; $image_url = wpl_items::get_folder($params['image_parentid'], 2) . $resized_image_name; /** check resized files existance and rewrite option **/ if ($rewrite or !wpl_file::exists($image_dest)) { if ($watermark) { self::resize_watermark_image($source, $image_dest, $width, $height); } else { self::resize_image($source, $image_dest, $width, $height, $crop); } } return $image_url; }
<div id="progress" class="progress progress-success progress-striped"> <div class="bar"></div> </div> </div> <div class="error_uploaded_message" id="error_ajax_att"> </div> <!-- The container for the uploaded files --> <div id="attaches" class="attachment-wp wpl_files_container"> <ul class="ui-sortable" id="ajax_att_sortable"> <?php // get uploaded attachments and show them $att_items = wpl_items::get_items($item_id, 'attachment', $this->kind, '', ''); $att_folder = wpl_items::get_folder($item_id, $this->kind); $attachment_categories = wpl_items::get_item_categories('attachment', $this->kind); $max_index_att = 0; foreach ($att_items as $attachment) { $attachment->index = intval($attachment->index); if ($max_index_att < $attachment->index) { $max_index_att = $attachment->index; } ?> <li class="ui-state-default" id="ajax_attachment<?php echo $attachment->index; ?> "> <input type="hidden" class="att_name" value="<?php echo $attachment->item_name; ?> "/>
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); $this->_wpl_import($this->tpl_path . '.scripts.js', true, true); $js = (object) array('param1' => 'jquery-video-js-script', 'param2' => 'packages/video-js/video.js'); $style = (object) array('param1' => 'ajax-video-js-style', 'param2' => 'packages/video-js/video-js.min.css'); /** import styles and javascripts **/ wpl_extensions::import_javascript($js); wpl_extensions::import_style($style); /** 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; $raw_videos = isset($wpl_properties['current']['items']['video']) ? $wpl_properties['current']['items']['video'] : NULL; $videos = wpl_items::render_videos($raw_videos); $video_width = isset($params['video_width']) ? $params['video_width'] : 640; $video_height = isset($params['video_height']) ? $params['video_height'] : 270; if (!count($videos) or !is_array($videos)) { return; } ?> <div class="wpl_videos_container" id="wpl_videos_container<?php echo $property_id; ?> "> <ul class="wpl_videos_list_container"> <?php foreach ($videos as $video) { ?> <li class="wpl_videos_video wpl_video_type<?php echo isset($video['item_cat']) ? $video['item_cat'] : '';
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); if ($type == 'rooms' and !$done_this) { _wpl_import('libraries.items'); _wpl_import('libraries.room_types'); $room_items = wpl_items::get_items($item_id, 'rooms', $this->kind); $all_room_type = wpl_room_types::get_room_types(); ?> <script type="text/javascript"> function wpl_delete_room(id) { var ajax = wpl_run_ajax_query('<?php echo wpl_global::get_full_url(); ?> ', "wpl_format=b:listing:rooms&wpl_function=delete_room&pid=<?php echo $item_id; ?> &kind=<?php echo $this->kind; ?> &item_id=" + id); ajax.success(function(data) { wplj(".room_" + id).hide(500).remove(); }); } function wpl_save_room() {
<div class="bar"></div> </div> </div> <div class="error_uploaded_message" id="error_ajax_img"> </div> <!-- The container for the uploaded files --> <div id="files" class="gallary-images-wp wpl_files_container"> <ul class="ui-sortable" id="ajax_gal_sortable"> <?php // get uploaded images and show them $gall_items = wpl_items::get_items($item_id, 'gallery', $this->kind, '', ''); $image_folder = wpl_items::get_folder($item_id, $this->kind); $image_path = wpl_items::get_path($item_id, $this->kind); $image_categories = wpl_items::get_item_categories('gallery', $this->kind); $max_img_index = 0; foreach ($gall_items as $image) { $image->index = intval($image->index); if ($max_img_index < $image->index) { $max_img_index = $image->index; } /** set resize method parameters **/ $params = array(); $params['image_name'] = $image->item_name; $params['image_parentid'] = $image->parent_id; $params['image_parentkind'] = $image->parent_kind; $params['image_source'] = $image_path . $image->item_name; $image_thumbnail_url = wpl_images::create_gallary_image(80, 60, $params, 1, 0); if ($image->item_cat == 'external') { $image_thumbnail_url = $image->item_extra3;
/** * 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; }
$forclosure = ''; if (isset($wpl_properties['current']['materials']['sp_featured']) and $wpl_properties['current']['materials']['sp_featured']) { $features = '<div class="wpl-listing-tag-feature">' . $wpl_properties['current']['materials']['sp_featured']['name'] . '</div>'; } if (isset($wpl_properties['current']['materials']['sp_hot']) and $wpl_properties['current']['materials']['sp_hot']) { $hot_offer = '<div class="wpl-listing-tag-hot-offer">' . $wpl_properties['current']['materials']['sp_hot']['name'] . '</div>'; } if (isset($wpl_properties['current']['materials']['sp_openhouse']) and $wpl_properties['current']['materials']['sp_openhouse']) { $open_house = '<div class="wpl-listing-tag-open-house">' . $wpl_properties['current']['materials']['sp_openhouse']['name'] . '</div>'; } if (isset($wpl_properties['current']['materials']['sp_forclosure']) and $wpl_properties['current']['materials']['sp_forclosure']) { $forclosure = '<div class="wpl-listing-tag-forclosure">' . $wpl_properties['current']['materials']['sp_forclosure']['name'] . '</div>'; } /** render gallery **/ $raw_gallery = isset($wpl_properties['current']['items']['gallery']) ? $wpl_properties['current']['items']['gallery'] : array(); $gallery = wpl_items::render_gallery($raw_gallery); ?> <div class="wpl_gallery_container" id="wpl_gallery_container<?php echo $this->property_id; ?> "> <?php if (!count($gallery)) { echo '<div class="no_image_box"></div>'; } else { $image_url = $gallery[0]['url']; if (isset($gallery[0]['item_extra2'])) { $image_alt = $gallery[0]['item_extra2']; } elseif (isset($wpl_properties['current']['raw']['meta_keywords'])) { $image_alt = $wpl_properties['current']['raw']['meta_keywords']; }
/** * Sets property single page parameters * @author Howard <*****@*****.**> * @param int $proeprty_id */ public function set_property_page_params($proeprty_id) { _wpl_import('libraries.property'); $current_link_url = wpl_global::get_full_url(); $property_data = wpl_property::get_property_raw_data($proeprty_id); $locale = wpl_global::get_current_language(); $this->property_page_title = wpl_property::update_property_page_title($property_data); $meta_keywords_column = 'meta_keywords'; if (wpl_global::check_multilingual_status() and wpl_addon_pro::get_multiligual_status_by_column($meta_keywords_column, $property_data['kind'])) { $meta_keywords_column = wpl_addon_pro::get_column_lang_name($meta_keywords_column, $locale, false); } $this->property_keywords = $property_data[$meta_keywords_column]; $meta_description_column = 'meta_description'; if (wpl_global::check_multilingual_status() and wpl_addon_pro::get_multiligual_status_by_column($meta_description_column, $property_data['kind'])) { $meta_description_column = wpl_addon_pro::get_column_lang_name($meta_description_column, $locale, false); } $this->property_description = $property_data[$meta_description_column]; $html = wpl_html::getInstance(); /** set title **/ $html->set_title($this->property_page_title); /** set meta keywords **/ $html->set_meta_keywords($this->property_keywords); /** set meta description **/ $html->set_meta_description($this->property_description); /** SET og meta parameters for social websites like facebook etc **/ wpl_html::$canonical = str_replace('&', '&', $current_link_url); $html->set_custom_tag('<meta property="og:type" content="property" />'); $html->set_custom_tag('<meta property="og:locale" content="' . $locale . '" />'); $content_column = 'field_308'; if (wpl_global::check_multilingual_status() and wpl_addon_pro::get_multiligual_status_by_column($content_column, $property_data['kind'])) { $content_column = wpl_addon_pro::get_column_lang_name($content_column, $locale, false); } $html->set_custom_tag('<meta property="og:url" content="' . str_replace('&', '&', $current_link_url) . '" />'); $html->set_custom_tag('<meta property="og:title" data-page-subject="true" content="' . $this->property_page_title . '" />'); $html->set_custom_tag('<meta property="og:description" content="' . strip_tags($property_data[$content_column]) . '" />'); $html->set_custom_tag('<meta property="twitter:card" content="summary" />'); $html->set_custom_tag('<meta property="twitter:title" content="' . $this->property_page_title . '" />'); $html->set_custom_tag('<meta property="twitter:description" content="' . strip_tags($property_data[$content_column]) . '" />'); $html->set_custom_tag('<meta property="twitter:url" content="' . str_replace('&', '&', $current_link_url) . '" />'); $gallery = wpl_items::get_gallery($proeprty_id, $property_data['kind']); if (is_array($gallery) and count($gallery)) { foreach ($gallery as $image) { $html->set_custom_tag('<meta property="og:image" content="' . $image['url'] . '" />'); $html->set_custom_tag('<meta property="twitter:image" content="' . $image['url'] . '" />'); } } }
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; }
<?php /** no direct access * */ defined('_WPLEXEC') or die('Restricted access'); if ($type == 'googlemap' and !$done_this) { /** WPL Demographic addon **/ $demographic_objects = array(); if (wpl_global::check_addon('demographic')) { _wpl_import('libraries.addon_demographic'); $demographic = new wpl_addon_demographic(); $demographic_objects = wpl_items::get_items($item_id, 'demographic', $kind); } $w = 450; $h = 300; $ln_table_col = 'googlemap_ln'; $lt_table_col = 'googlemap_lt'; $javascript = (object) array('param1' => 'wpl-googlemap-api3', 'param2' => 'http' . (stristr(wpl_global::get_full_url(), 'https://') != '' ? 's' : '') . '://maps.google.com/maps/api/js?libraries=places,drawing&sensor=false', 'external' => true); wpl_extensions::import_javascript($javascript); ?> <script type="text/javascript"> wplj(document).ready(function() { try { wplj(".wpl_listing_all_location_container_locations, .wpl_c_field_42, .wpl_c_post_code, .wpl_c_street_no").change(function() { wpl_address_creator(); wpl_code_address(wplj("#wpl_map_address<?php echo $field->id; ?> ").val());
<!-- The global progress bar --> <div id="progress_vid"> <div id="progress" class="progress progress-success progress-striped"> <div class="bar"></div> </div> </div> <div class="error_uploaded_message" id="error_ajax_vid"> </div> <!-- The container for the uploaded files --> <div id="video" class="video-list-wp wpl_files_container"> <ul class="ui-sortable" id="ajax_vid_sortable"> <?php // get uploaded videos and show them $vid_items = wpl_items::get_items($item_id, 'video', $this->kind, 'video', ''); $vid_folder = wpl_items::get_folder($item_id, $this->kind); $video_categories = wpl_items::get_item_categories('addon_video', $this->kind); $max_index_vid = 0; foreach ($vid_items as $video) { $video->index = intval($video->index); if ($max_index_vid < $video->index) { $max_index_vid = $video->index; } ?> <li class="ui-state-default" id="ajax_video<?php echo $video->index; ?> "> <input type="hidden" class="vid_name" value="<?php echo $video->item_name; ?> "/>
<?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; $raw_attachments = isset($wpl_properties['current']['items']['attachment']) ? $wpl_properties['current']['items']['attachment'] : NULL; $attachments = wpl_items::render_attachments($raw_attachments); if (!count($attachments) or !is_array($attachments)) { return; } ?> <div class="wpl_attachments_container" id="wpl_attachments_container<?php echo $property_id; ?> "> <ul class="wpl_attachments_list_container clearfix"> <?php foreach ($attachments as $attachment) { ?> <li class="wpl_attachments_room type_<?php echo $attachment['ext']; ?> " id="wpl_attachments_attachment<?php echo $attachment['item_id']; ?> "> <a class="wpl_attachment_link" href="<?php echo $attachment['url']; ?>
/** * Removes user thumbnails * @author Howard R <*****@*****.**> * @static * @param int $user_id * @return boolean */ public static function remove_thumbnails($user_id) { /** first validation **/ if (!trim($user_id)) { return false; } $ext_array = array('jpg', 'jpeg', 'gif', 'png'); $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); } return true; }
/** * Returns property featured image if exists otherwise it returns empty string * @author Howard <*****@*****.**> * @static * @param int $property_id * @param string $sizes * @return string */ public static function get_property_image($property_id, $sizes = '150*150') { if (!trim($property_id)) { return false; } if (!trim($sizes)) { $sizes = '150*150'; } $images = wpl_items::render_gallery_custom_sizes($property_id, NULL, array($sizes)); $size_alias = str_replace('*', '_', $sizes); return count($images) ? $images[$size_alias][0]['url'] : ''; }