Пример #1
0
 private function save_multilingual()
 {
     $dbst_id = wpl_request::getVar('dbst_id');
     $value = wpl_db::escape(wpl_request::getVar('value'));
     $item_id = wpl_request::getVar('item_id');
     $lang = wpl_request::getVar('lang');
     $field = wpl_flex::get_field($dbst_id);
     $table_name = $field->table_name;
     $table_column1 = wpl_addon_pro::get_column_lang_name($field->table_column, $lang, false);
     $default_language = wpl_addon_pro::get_default_language();
     $table_column2 = NULL;
     if (strtolower($default_language) == strtolower($lang)) {
         $table_column2 = wpl_addon_pro::get_column_lang_name($field->table_column, $lang, true);
     }
     wpl_db::set($table_name, $item_id, $table_column1, $value, 'id');
     if ($table_column2) {
         wpl_db::set($table_name, $item_id, $table_column2, $value, 'id');
     }
     $res = 1;
     $message = $res ? __('Saved.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN);
     $data = NULL;
     $response = array('success' => $res, 'message' => $message, 'data' => $data);
     echo json_encode($response);
     exit;
 }
Пример #2
0
 private function report_abuse_submit()
 {
     $parameters = wpl_request::getVar('wplfdata', array());
     $property_id = isset($parameters['property_id']) ? $parameters['property_id'] : 0;
     $returnData = array();
     if (!$property_id) {
         $returnData['success'] = 0;
         $returnData['message'] = __('Invalid Property!', WPL_TEXTDOMAIN);
     } elseif (isset($parameters['email']) and !filter_var($parameters['email'], FILTER_VALIDATE_EMAIL)) {
         $returnData['success'] = 0;
         $returnData['message'] = __('Your email is not valid!', WPL_TEXTDOMAIN);
     } else {
         $PRO = new wpl_addon_pro();
         if ($PRO->report_abuse_send($parameters)) {
             $returnData['success'] = 1;
             $returnData['message'] = __('Abuse report sent successfully.', WPL_TEXTDOMAIN);
         } else {
             $returnData['success'] = 0;
             $returnData['message'] = __('Error sending!', WPL_TEXTDOMAIN);
         }
     }
     echo json_encode($returnData);
     exit;
 }
Пример #3
0
    echo wpl_property::get_property_pdf_link($property_id);
    ?>
" target="_blank"><?php 
    echo __('PDF', WPL_TEXTDOMAIN);
    ?>
</a>
		</li>
        <?php 
}
?>

        <?php 
if ($show_favorite) {
    ?>
        <?php 
    $find_favorite_item = in_array($property_id, wpl_addon_pro::favorite_get_pids());
    ?>
        <li class="favorite_link<?php 
    echo $find_favorite_item ? ' added' : '';
    ?>
">
            <a href="#" style="<?php 
    echo $find_favorite_item ? 'display: none;' : '';
    ?>
" id="wpl_favorite_add_<?php 
    echo $property_id;
    ?>
" onclick="return wpl_favorite_control(<?php 
    echo $property_id;
    ?>
, 1);"><?php 
Пример #4
0
            </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>
                <?php 
Пример #5
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>';
     }
 }
Пример #6
0
 private function save_dbst()
 {
     $dbst_id = wpl_request::getVar('dbst_id', 0);
     $post = wpl_request::get('post');
     $mode = 'edit';
     /** insert new field **/
     if (!$dbst_id) {
         $mode = 'add';
         $dbst_id = wpl_flex::create_default_dbst();
     }
     $q = '';
     foreach ($post as $field => $value) {
         if (substr($field, 0, 4) != 'fld_') {
             continue;
         }
         $key = substr($field, 4);
         if (trim($key) == '') {
             continue;
         }
         $q .= "`{$key}`='{$value}', ";
     }
     /** add options to query **/
     $options = wpl_flex::get_encoded_options($post, 'opt_', wpl_flex::get_field_options($dbst_id));
     $q .= "`options`='" . wpl_db::escape($options) . "', ";
     $q = trim($q, ", ");
     $query = "UPDATE `#__wpl_dbst` SET " . $q . " WHERE `id`='{$dbst_id}'";
     wpl_db::q($query, 'update');
     $dbst_type = wpl_flex::get_dbst_key('type', $dbst_id);
     $dbst_kind = wpl_flex::get_dbst_key('kind', $dbst_id);
     /** run queries **/
     if ($mode == 'add') {
         wpl_flex::run_dbst_type_queries($dbst_id, $dbst_type, $dbst_kind, 'add');
     }
     /** Multilingual **/
     if (wpl_global::check_addon('pro')) {
         wpl_addon_pro::multilingual($dbst_id);
     }
     /** trigger event **/
     wpl_global::event_handler('dbst_modified', array('id' => $dbst_id, 'mode' => $mode, 'kind' => $dbst_kind, 'type' => $dbst_type));
     /** echo response **/
     echo json_encode(array('success' => 1, 'message' => __('Field saved.', WPL_TEXTDOMAIN), 'data' => NULL));
     exit;
 }
Пример #7
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;
 }
Пример #8
0
            echo $wpllang;
            ?>
" class="wpl-multiling-flag wpl-multiling-flag-<?php 
            echo strtolower(substr($wpllang, -2));
            echo empty($values[$lang_column]) ? ' wpl-multiling-empty' : '';
            ?>
"></div>
            <?php 
        }
        ?>
        </div>
        <div class="wpl-multiling-edit-btn"></div>
        <div class="wpl-multilang-field-cnt">
            <?php 
        foreach ($wpllangs as $wpllang) {
            $lang_column = wpl_addon_pro::get_column_lang_name($field->table_column, $wpllang, false);
            ?>
            <div class="wpl-lang-cnt" id="wpl_langs_cnt_<?php 
            echo $field->id;
            ?>
_<?php 
            echo strtolower($wpllang);
            ?>
">
                <label for="wpl_c_<?php 
            echo $field->id;
            ?>
_<?php 
            echo strtolower($wpllang);
            ?>
"><?php 
Пример #9
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;
 }
Пример #10
0
            $js_string .= '
            if (wplj("#wp-' . $field_id . '-wrap").hasClass("tmce-active"))
                txtarea_val = tinyMCE.get("' . $field_id . '").getContent();
            else
                txtarea_val = wplj("#' . $field_id . '").val();

            if(wplj.trim(txtarea_val) == "" && wplj("#wpl_listing_field_container' . $field->id . '").css("display") != "none")
            {
                wpl_alert("' . __('Enter a valid', WPL_TEXTDOMAIN) . ' ' . __($label, WPL_TEXTDOMAIN) . '!");
                return false;
            }
            ';
        }
    } else {
        if ($field->multilingual == 1 and wpl_global::check_multilingual_status()) {
            $default_language = wpl_addon_pro::get_default_language();
            $field_id = 'wpl_c_' . $field->id . '_' . strtolower($default_language);
            $js_string .= '
            if(wplj.trim(wplj("#' . $field_id . '").val()) == "" && wplj("#wpl_listing_field_container' . $field->id . '").css("display") != "none")
            {
                wpl_alert("' . sprintf(__('Enter a valid %s for %s!', WPL_TEXTDOMAIN), __($label, WPL_TEXTDOMAIN), $default_language) . '");
                return false;
            }
            ';
        } else {
            $field_id = 'wpl_c_' . $field->id;
            $js_string .= '
            if(wplj.trim(wplj("#' . $field_id . '").val()) == "" && wplj("#wpl_listing_field_container' . $field->id . '").css("display") != "none")
            {
                wpl_alert("' . __('Enter a valid', WPL_TEXTDOMAIN) . ' ' . __($label, WPL_TEXTDOMAIN) . '!");
                return false;
Пример #11
0
 private function generate_language_keywords()
 {
     wpl_addon_pro::generate_dynamic_keywords();
     $res = 1;
     $message = $res ? __('Language strings are generated.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN);
     $data = NULL;
     $response = array('success' => $res, 'message' => $message, 'data' => $data);
     echo json_encode($response);
     exit;
 }
Пример #12
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'] . '" />');
         }
     }
 }
Пример #13
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;
 }
Пример #14
0
    }
    $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);
        $min = isset($vars['sf_min_' . $table_column]) ? $vars['sf_min_' . $table_column] : 0;
Пример #15
0
        if (isset($options['if_zero']) and $options['if_zero'] == 2 and $value == '0') {
            $return['value'] = __($options['call_text'], WPL_TEXTDOMAIN);
        }
        if (isset($options['if_zero']) and !$options['if_zero'] and $value == '0') {
            $return = array();
        }
    }
    $done_this = true;
} elseif ($type == 'textarea' and !$done_this) {
    if (trim($value) != '') {
        $return['field_id'] = $field->id;
        $return['type'] = $field->type;
        $return['name'] = __($field->name, WPL_TEXTDOMAIN);
        if (isset($field->multilingual) and $field->multilingual and wpl_global::check_multilingual_status()) {
            $current_language = wpl_global::get_current_language();
            $lang_column = wpl_addon_pro::get_column_lang_name($field->table_column, $current_language, false);
            if (isset($values[$lang_column])) {
                $value = $values[$lang_column];
            }
        }
        $value = stripslashes($value);
        if (in_array($field->id, array(308, 1160))) {
            $value = apply_filters('the_content', $value);
        }
        $value = wpl_global::do_shortcode($value);
        $return['value'] = $value;
    }
    $done_this = true;
} elseif ($type == 'select' and !$done_this) {
    if (trim($value) and trim($value) != '-1') {
        $return['field_id'] = $field->id;
Пример #16
0
 /**
  * This is a very useful function for rendering whole data of property. you need to just pass property_id and get everything!
  * @author Howard <*****@*****.**>
  * @static
  * @param int $property_id
  * @param array $plisting_fields
  * @param array $property
  * @param array $params
  * @return array
  */
 public static function full_render($property_id, $plisting_fields = NULL, $property = NULL, $params = array())
 {
     /** get plisting fields **/
     if (!$plisting_fields) {
         $plisting_fields = self::get_plisting_fields();
     }
     $raw_data = self::get_property_raw_data($property_id);
     if (!$raw_data) {
         return array();
     }
     if (!$property) {
         $property = (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_property::generate_rendered_data($property_id), true);
     } elseif (!wpl_settings::get('cache')) {
         $rendered = array();
     } else {
         $rendered = json_decode($raw_data[$column], true);
     }
     $result = array();
     $result['data'] = (array) $property;
     if (!isset($rendered['rendered']) or !isset($rendered['materials'])) {
         /** render data on the fly **/
         $find_files = array();
         $rendered_fields = self::render_property($property, $plisting_fields, $find_files, true);
     }
     if (isset($rendered['rendered']) and $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'];
     }
     $result['items'] = wpl_items::get_items($property_id, '', $property->kind, '', 1);
     $result['raw'] = $raw_data;
     /** location text **/
     $result['location_text'] = self::generate_location_text($raw_data);
     /** property full link **/
     $target_page = isset($params['wpltarget']) ? $params['wpltarget'] : 0;
     $result['property_link'] = self::get_property_link($raw_data, NULL, $target_page);
     $result['property_title'] = self::update_property_title($raw_data);
     return $result;
 }
Пример #17
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;
 }
Пример #18
0
<?php

/** no direct access **/
defined('_WPLEXEC') or die('Restricted access');
if ($type == 'languages' and !$done_this) {
    $languages = wpl_addon_pro::get_wpl_languages();
    $lang_options = wpl_addon_pro::get_wpl_language_options();
    $max_langs = max(wpl_global::get_setting('max_wpllangs'), count($languages));
    $wp_pages = wpl_global::get_wp_pages();
    ?>
<div class="prow wpl_setting_form_container wpl-setting-langs wpl_st_type<?php 
    echo $setting_record->type;
    ?>
 wpl_st_<?php 
    echo $setting_record->setting_name;
    ?>
"
    id="wpl_st_<?php 
    echo $setting_record->id;
    ?>
">
    <div class="languages-wp">
        <div class="wpl-btns-wp">
            <button onclick="wpl_languages_save();" class="wpl-button button-1">
                <?php 
    echo __('Save', WPL_TEXTDOMAIN);
    ?>
                <span class="ajax-inline-save" id="wpl_ajax_loader_<?php 
    echo $setting_record->id;
    ?>
"></span>