示例#1
0
 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'));
     $vars = array_merge($vars, array('sf_select_parent' => $this->parent, 'sf_select_enabled' => $this->enabled));
     $where_query = wpl_db::create_query($vars);
     $num_result = wpl_db::num("SELECT COUNT(id) FROM `#__wpl_location" . $this->level . "` WHERE 1 " . $where_query);
     $this->pagination = wpl_pagination::get_pagination($num_result, $page_size);
     $where_query .= " ORDER BY {$orderby} {$order} " . $this->pagination->limit_query;
     $this->wp_locations = wpl_locations::get_locations(!$this->load_zipcodes ? $this->level : 'zips', '', '', $where_query);
     $this->zipcode_parent_level = wpl_settings::get('zipcode_parent_level');
     /** import tpl **/
     parent::render($this->tpl_path, $this->tpl);
 }
示例#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 one WPL setting value
  * @author Howard <*****@*****.**>
  * @static
  * @param string $setting_name
  * @param int|string $category
  * @return mixed
  */
 public static function get_setting($setting_name, $category = '')
 {
     /** import library **/
     _wpl_import('libraries.settings');
     return wpl_settings::get($setting_name, $category);
 }
示例#4
0
				wplj(this).remove();
			});
		});
	}
}

function video_select_tab(id)
{
	wplj('#video-tabs').find('li').removeClass('active').eq(id).addClass('active');
	var _this = wplj('#video-tabs').find('li:eq(' + id + ') > a');
	wplj('.video-content-wp').find('> div').hide().filter(_this.attr('href')).fadeIn(600);
}
</script>

<?php 
    if (wpl_settings::get('video_uploader')) {
        ?>
<div class="content-wp hidden" id="uploader">
	<div class="upload-btn-wp">
		<div class="wpl-button button-1 button-upload">
			<span><?php 
        echo __('Select Files', WPL_TEXTDOMAIN);
        ?>
</span>
			<input id="video_upload" type="file" name="files[]" multiple="multiple"/>
		</div>
		<div class="field-desc">
			<?php 
        echo __('Please choose all videos you want. Just click on the "Select Files" button.', WPL_TEXTDOMAIN);
        ?>
		</div>
示例#5
0
 /**
  * Updates properties and regenerate some of cached property data
  * @author Howard R <*****@*****.**>
  * @static
  * @param string $column
  * @param mixed $previous_value
  * @param mixed $new_value
  * @return boolean
  */
 public static function update_properties($column, $previous_value, $new_value)
 {
     $listings = wpl_property::get_properties_list($column, $previous_value);
     $query = "UPDATE `#__wpl_properties` SET `{$column}`='{$new_value}' WHERE `{$column}`='{$previous_value}'";
     $result = wpl_db::q($query);
     foreach ($listings as $listing) {
         $pid = $listing['id'];
         $property = self::get_property_raw_data($pid);
         wpl_property::update_text_search_field($pid);
         wpl_property::update_alias($property, $pid);
         wpl_property::update_numbs($pid, $property);
         /** generate rendered data **/
         if (wpl_settings::get('cache')) {
             wpl_property::generate_rendered_data($pid);
         }
     }
     return $result;
 }
示例#6
0
 private function remove_upload()
 {
     $setting_name = wpl_request::getVar('setting_name', '');
     $settings_value = wpl_settings::get($setting_name);
     $upload_src = wpl_global::get_wpl_asset_url('img/system/' . $settings_value);
     wpl_settings::save_setting($setting_name, NULL);
     wpl_file::delete($upload_src);
     /** Remove Thumbnails **/
     wpl_settings::clear_cache('listings_thumbnails');
     wpl_settings::clear_cache('users_thumbnails');
     $response = array('success' => 1, 'message' => __('Uploaded file removed successfully!', WPL_TEXTDOMAIN));
     echo json_encode($response);
     exit;
 }