Пример #1
0
                </ul>
            </div>
        </div>
        <div class="wpl_prp_container_content">
            <div class="wpl_prp_container_content_title">
                <?php 
echo '<h1 class="title_text">' . $prp_title . '</h1>';
echo '<h2 class="location_build_up">' . (trim($build_up_area) ? $build_up_area . ' - ' : '') . '<span itemprop="address">' . $location_string . '</span></h2>';
/** load QR Code **/
wpl_activity::load_position('pshow_qr_code', array('wpl_properties' => $this->wpl_properties));
?>
            </div>
            <div class="wpl_prp_container_content_left">
				<?php 
$description_column = 'field_308';
if (wpl_global::check_multilingual_status()) {
    $description_column = wpl_addon_pro::get_column_lang_name($description_column, wpl_global::get_current_language(), false);
}
if ($this->wpl_properties['current']['data'][$description_column]) {
    ?>
                <div class="wpl_prp_show_detail_boxes">
                    <div class="wpl_prp_show_detail_boxes_title"><?php 
    echo __('Property Description', WPL_TEXTDOMAIN);
    ?>
</div>
                    <div class="wpl_prp_show_detail_boxes_cont" itemprop="description">
                        <?php 
    echo apply_filters('the_content', stripslashes($this->wpl_properties['current']['data'][$description_column]));
    ?>
                    </div>
                </div>
Пример #2
0
 /**
  * This is a very useful function for rendering whole data of user. you need to just pass user_id and get everything!
  * @author Howard R <*****@*****.**>
  * @static
  * @param int $user_id
  * @param array $plisting_fields
  * @param array $profile
  * @param array $params
  * @return array
  */
 public static function full_render($user_id, $plisting_fields = NULL, $profile = NULL, $params = array())
 {
     /** get plisting fields **/
     if (!$plisting_fields) {
         $plisting_fields = self::get_plisting_fields();
     }
     $raw_data = (array) self::get_wpl_user($user_id);
     if (!$profile) {
         $profile = (object) $raw_data;
     }
     $column = 'rendered';
     if (wpl_global::check_multilingual_status()) {
         $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false);
     }
     /** generate rendered data if rendered data is empty **/
     if (!trim($raw_data[$column]) and wpl_settings::get('cache')) {
         $rendered = json_decode(wpl_users::generate_rendered_data($user_id), true);
     } elseif (!wpl_settings::get('cache')) {
         $rendered = array();
     } else {
         $rendered = json_decode($raw_data[$column], true);
     }
     $result = array();
     $result['data'] = (array) $profile;
     $result['items'] = wpl_items::get_items($profile->id, '', 2, '', 1);
     $result['raw'] = $raw_data;
     if (!isset($rendered['rendered']) or !isset($rendered['materials'])) {
         /** render data on the fly **/
         $find_files = array();
         $rendered_fields = self::render_profile($profile, $plisting_fields, $find_files, true);
     }
     if (isset($rendered['rendered'])) {
         $result['rendered'] = $rendered['rendered'];
     } else {
         $result['rendered'] = $rendered_fields['ids'];
     }
     if (isset($rendered['materials']) and $rendered['materials']) {
         $result['materials'] = $rendered['materials'];
     } else {
         $result['materials'] = $rendered_fields['columns'];
     }
     /** location text **/
     if (isset($rendered['location_text'])) {
         $result['location_text'] = $rendered['location_text'];
     } else {
         $result['location_text'] = self::generate_location_text($raw_data);
     }
     /** profile full link **/
     $target_id = isset($params['wpltarget']) ? $params['wpltarget'] : 0;
     $result['profile_link'] = self::get_profile_link($profile->id, $target_id);
     /** profile picture **/
     if (trim($raw_data['profile_picture']) != '') {
         $result['profile_picture'] = array('url' => wpl_items::get_folder($profile->id, 2) . $raw_data['profile_picture'], 'path' => wpl_items::get_path($profile->id, 2) . $raw_data['profile_picture'], 'name' => $raw_data['profile_picture']);
     }
     /** company logo **/
     if (trim($raw_data['company_logo']) != '') {
         $result['company_logo'] = array('url' => wpl_items::get_folder($profile->id, 2) . $raw_data['company_logo'], 'path' => wpl_items::get_path($profile->id, 2) . $raw_data['company_logo'], 'name' => $raw_data['company_logo']);
     }
     /** Emails url **/
     if (wpl_file::exists(wpl_items::get_path($profile->id, 2) . 'main_email.png')) {
         $result['main_email_url'] = wpl_items::get_folder($profile->id, 2) . 'main_email.png';
     }
     if (wpl_file::exists(wpl_items::get_path($profile->id, 2) . 'second_email.png')) {
         $result['second_email_url'] = wpl_items::get_folder($profile->id, 2) . 'second_email.png';
     }
     return $result;
 }
Пример #3
0
 /**
  * Returns column with multilingual columns
  * @author Howard <*****@*****.**>
  * @static
  * @param array $columns
  * @param string $table
  * @return array
  */
 public static function get_multilingual_columns($columns, $validation = true, $table = 'wpl_properties')
 {
     if (wpl_global::check_multilingual_status()) {
         $valid_columns = wpl_db::columns($table);
         $languages = wpl_addon_pro::get_wpl_languages();
         foreach ($columns as $column) {
             foreach ($languages as $language) {
                 $language_column = wpl_addon_pro::get_column_lang_name($column, $language, false);
                 if ($validation and in_array($language_column, $valid_columns)) {
                     $columns[] = $language_column;
                 } elseif (!$validation) {
                     $columns[] = $language_column;
                 }
             }
         }
     }
     return $columns;
 }
Пример #4
0
 /**
  * Generates wizard form using dbst fields
  * @author Howard R <*****@*****.**>
  * @param objects $fields
  * @param array $values
  * @param int $item_id
  * @param array $finds
  * @return void
  */
 public function generate_wizard_form($fields, $values, $item_id = 0, &$finds = array())
 {
     /** first validation **/
     if (!$fields) {
         return;
     }
     /** get files **/
     $path = WPL_ABSPATH . DS . 'libraries' . DS . 'dbst_wizard';
     $files = array();
     if (wpl_folder::exists($path)) {
         $files = wpl_folder::files($path, '.php$', false, false);
     }
     $wpllangs = wpl_global::check_multilingual_status() ? wpl_addon_pro::get_wpl_languages() : array();
     $has_more_details = false;
     foreach ($fields as $key => $field) {
         if (!$field) {
             return;
         }
         $done_this = false;
         $type = $field->type;
         $label = $field->name;
         $mandatory = $field->mandatory;
         $options = json_decode($field->options, true);
         $value = isset($values[$field->table_column]) ? stripslashes($values[$field->table_column]) : NULL;
         $kind = isset($values['kind']) ? $values['kind'] : NULL;
         $display = '';
         /** Specific **/
         if (trim($field->listing_specific) != '') {
             $specified_listings = explode(',', trim($field->listing_specific, ', '));
             self::$category_listing_specific_array[$field->id] = $specified_listings;
             if (!in_array($values['listing'], $specified_listings)) {
                 $display = 'display: none;';
             }
         } elseif (trim($field->property_type_specific) != '') {
             $specified_property_types = explode(',', trim($field->property_type_specific, ', '));
             self::$category_property_type_specific_array[$field->id] = $specified_property_types;
             if (!in_array($values['property_type'], $specified_property_types)) {
                 $display = 'display: none;';
             }
         } elseif (trim($field->user_specific) != '') {
             $specified_user_types = explode(',', trim($field->user_specific, ', '));
             self::$category_user_specific_array[$field->id] = $specified_user_types;
             if (!in_array($values['membership_type'], $specified_user_types)) {
                 $display = 'display: none;';
             }
         } elseif (isset($options['access'])) {
             foreach ($options['access'] as $access) {
                 if (!wpl_global::check_access($access)) {
                     $display = 'display: none;';
                     break;
                 }
             }
         }
         /** More Details **/
         if ($type == 'more_details' and !$has_more_details) {
             echo '<div class="wpl_listing_field_container wpl-pwizard-prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '">';
             echo '<label for="wpl_c_' . $field->id . '"><span>' . __($label, WPL_TEXTDOMAIN) . '</span></label>';
             echo '<div id="wpl_more_details' . $field->id . '" style="display: none;" class="wpl-fields-more-details-block">';
             $has_more_details = true;
         } elseif ($type == 'more_details' and $has_more_details) {
             /** Only one details field is acceptable in each category **/
             continue;
         }
         /** Accesses **/
         if (isset($field->accesses) and trim($field->accesses) != '' and wpl_global::check_addon('membership')) {
             $accesses = explode(',', trim($field->accesses, ', '));
             $cur_membership_id = wpl_users::get_user_membership();
             if (!in_array($cur_membership_id, $accesses) and trim($field->accesses_message) == '') {
                 continue;
             } elseif (!in_array($cur_membership_id, $accesses) and trim($field->accesses_message) != '') {
                 echo '<div class="prow wpl_listing_field_container prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '" style="' . $display . '">';
                 echo '<label for="wpl_c_' . $field->id . '">' . __($label, WPL_TEXTDOMAIN) . '</label>';
                 echo '<span class="wpl-access-blocked-message">' . __($field->accesses_message, WPL_TEXTDOMAIN) . '</span>';
                 echo '</div>';
                 continue;
             }
         }
         /** js validation **/
         self::$wizard_js_validation[$field->id] = self::generate_js_validation($field);
         if (isset($finds[$type])) {
             echo '<div class="prow wpl_listing_field_container prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '" style="' . $display . '">';
             include $path . DS . $finds[$type];
             echo '</div>';
             continue;
         }
         echo '<div class="prow wpl_listing_field_container prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '" style="' . $display . '">';
         foreach ($files as $file) {
             include $path . DS . $file;
             if ($done_this) {
                 $finds[$type] = $file;
                 break;
             }
         }
         echo '</div>';
     }
     if ($has_more_details) {
         echo '</div></div>';
     }
 }
Пример #5
0
<?php

/** no direct access **/
defined('_WPLEXEC') or die('Restricted access');
if ($type == 'meta_desc' and !$done_this) {
    $current_language = wpl_global::get_current_language();
    if (isset($field->multilingual) and $field->multilingual == 1 and wpl_global::check_multilingual_status()) {
        wp_enqueue_script('jquery-effects-clip', false, array('jquery-effects-core'));
        ?>
<label class="wpl-multiling-label wpl-multiling-text">
    <?php 
        echo __($label, WPL_TEXTDOMAIN);
        ?>
    <?php 
        if (in_array($mandatory, array(1, 2))) {
            ?>
<span class="required-star">*</span><?php 
        }
        ?>
</label>
<div class="wpl-multiling-field wpl-multiling-text">

    <div class="wpl-multiling-flags-wp">
        <div class="wpl-multiling-flag-cnt">
            <?php 
        foreach ($wpllangs as $wpllang) {
            $lang_column = wpl_addon_pro::get_column_lang_name($field->table_column, $wpllang, false);
            ?>
            <div data-wpl-field="wpl_c_<?php 
            echo $field->id;
            ?>
Пример #6
0
<?php

/** no direct access **/
defined('_WPLEXEC') or die('Restricted access');
$description_column = 'field_308';
if (wpl_global::check_multilingual_status() and wpl_addon_pro::get_multiligual_status_by_column($description_column, $this->kind)) {
    $description_column = wpl_addon_pro::get_column_lang_name($description_column, wpl_global::get_current_language(), false);
}
foreach ($this->wpl_properties as $key => $property) {
    if ($key == 'current') {
        continue;
    }
    /** unset previous property **/
    unset($this->wpl_properties['current']);
    /** set current property **/
    $this->wpl_properties['current'] = $property;
    $room = isset($property['materials']['bedrooms']) ? '<div class="bedroom">' . $property['materials']['bedrooms']['value'] . '</div>' : '';
    if ((!isset($property['materials']['bedrooms']) or isset($property['materials']['bedrooms']) and $property['materials']['bedrooms']['value'] == 0) and (isset($property['materials']['rooms']) and $property['materials']['rooms']['value'] != 0)) {
        $room = '<div class="room">' . $property['materials']['rooms']['value'] . '</div>';
    }
    $bathroom = isset($property['materials']['bathrooms']) ? '<div class="bathroom">' . $property['materials']['bathrooms']['value'] . '</div>' : '';
    $parking = (isset($property['raw']['f_150']) and trim($property['raw']['f_150_options'])) ? '<div class="parking">' . $property['raw']['f_150_options'] . '</div>' : '';
    $pic_count = '<div class="pic_count">' . $property['raw']['pic_numb'] . '</div>';
    $description = stripslashes(strip_tags($property['raw'][$description_column]));
    $cut_position = strrpos(substr($description, 0, 400), '.', -1);
    if (!$cut_position) {
        $cut_position = 399;
    }
    ?>
    <div class="wpl_prp_cont <?php 
    echo (isset($this->property_css_class) and in_array($this->property_css_class, array('row_box', 'grid_box'))) ? $this->property_css_class : '';
Пример #7
0
 /**
  * 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('&', '&amp;', $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('&', '&amp;', $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('&', '&amp;', $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'] . '" />');
         }
     }
 }
Пример #8
0
 /**
  * Removes property cache
  * @author Howard R <*****@*****.**>
  * @static
  * @param int $property_id
  * @return boolean
  */
 public static function clear_property_cache($property_id)
 {
     /** First Validation **/
     if (!trim($property_id)) {
         return false;
     }
     _wpl_import('libraries.settings');
     $q = " `location_text`='', `rendered`=''";
     if (wpl_global::check_multilingual_status()) {
         $q = wpl_settings::get_multilingual_query(array('location_text', 'rendered'));
     }
     $query = "UPDATE `#__wpl_properties` SET " . $q . " WHERE `id`='{$property_id}'";
     return wpl_db::q($query, 'UPDATE');
 }
Пример #9
0
 /**
  * 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;
 }
Пример #10
0
 /**
  * Returns WPL main page ID
  * @author Howard R <*****@*****.**>
  * @static
  * @return int
  */
 public static function get_wpl_main_page_id()
 {
     $main_permalink = wpl_global::get_setting('main_permalink');
     if (!is_numeric($main_permalink)) {
         $main_permalink = wpl_sef::get_post_id($main_permalink);
     }
     /** Multilingual **/
     if (wpl_global::check_multilingual_status()) {
         $lang_permalink = wpl_addon_pro::get_lang_main_page();
         if ($lang_permalink) {
             $main_permalink = $lang_permalink;
         }
     }
     return $main_permalink;
 }
Пример #11
0
        $query .= " AND `" . $table_column . "` != '" . $value . "'";
    }
    $done_this = true;
} elseif ($format == 'parent' and !$done_this) {
    if ($value != '-1' and trim($value) != '') {
        /** converts listing id to property id **/
        if ($value) {
            $value = wpl_property::pid($value);
        }
        $query .= " AND `parent` = '" . $value . "'";
    }
    $done_this = true;
} elseif ($format == 'textsearch' and !$done_this) {
    if (trim($value) != '') {
        /** If the field is multilingual or it is textsearch field **/
        if (wpl_global::check_multilingual_status() and (wpl_addon_pro::get_multiligual_status_by_column($table_column, wpl_request::getVar('kind', 0)) or $table_column == 'textsearch')) {
            $table_column = wpl_addon_pro::get_column_lang_name($table_column, wpl_global::get_current_language(), false);
        }
        $query .= " AND `" . $table_column . "` LIKE '%" . $value . "%'";
    }
    $done_this = true;
} elseif ($format == 'text' and !$done_this) {
    if (trim($value) != '') {
        $query .= " AND `" . $table_column . "` LIKE '%" . $value . "%'";
    }
    $done_this = true;
} elseif ($format == 'unit' and !$done_this) {
    /** importing library **/
    _wpl_import('libraries.units');
    if ($value != '-1' and trim($value) != '') {
        $unit_data = wpl_units::get_unit($value);
Пример #12
0
echo __('Yes', WPL_TEXTDOMAIN);
?>
</option>
        <option value="0" <?php 
if (isset($values->text_search) and $values->text_search == '0') {
    echo 'selected="selected"';
}
?>
><?php 
echo __('No', WPL_TEXTDOMAIN);
?>
</option>
    </select>
</div>
<?php 
if (wpl_global::check_multilingual_status() and (in_array($type, array('text', 'textarea', 'meta_key', 'meta_desc')) or isset($values->type) and in_array($values->type, array('text', 'textarea', 'meta_key', 'meta_desc')))) {
    ?>
<div class="fanc-row">
    <label for="<?php 
    echo $__prefix;
    ?>
multilingual"><?php 
    echo __('Multilingual', WPL_TEXTDOMAIN);
    ?>
</label>
    <select name="<?php 
    echo $__prefix;
    ?>
multilingual" id="<?php 
    echo $__prefix;
    ?>
Пример #13
0
 /**
  * Returns property meta description, This function calls on sef service when meta description of listing is empty
  * @author Howard <*****@*****.**>
  * @static
  * @param array $property_data
  * @param int $property_id
  * @return string
  */
 public static function get_meta_description($property_data, $property_id = 0)
 {
     /** 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'];
     }
     $locale = wpl_global::get_current_language();
     $column = 'field_308';
     if (wpl_global::check_multilingual_status() and wpl_addon_pro::get_multiligual_status_by_column($column, $property_data['kind'])) {
         $column = wpl_addon_pro::get_column_lang_name($column, $locale, false);
     }
     $description = substr($property_data[$column], 0, 250);
     /** apply filters **/
     _wpl_import('libraries.filters');
     @extract(wpl_filters::apply('generate_meta_description', array('description' => $description, 'property_data' => $property_data)));
     return $description;
 }