protected function generate_slide($category) { $tpl = 'internal_slide'; $this->fields = wpl_flex::get_fields($category->id, 0, $this->kind, 'flex', 1); $this->field_category = $category; /** import tpl **/ parent::render($this->tpl_path, $tpl); }
public function profile($instance = array()) { /** check access **/ if (!wpl_users::check_access('profilewizard')) { /** import message tpl **/ $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message'); } _wpl_import('libraries.flex'); $this->tpl = 'profile'; $this->kind = wpl_flex::get_kind_id('user'); $this->user_id = wpl_users::get_cur_user_id(); if (wpl_users::is_administrator($this->user_id) and wpl_request::getVar('id', 0)) { $this->user_id = wpl_request::getVar('id'); } $this->user_fields = wpl_flex::get_fields('', 1, $this->kind, 'pwizard', 1); $this->user_data = (array) wpl_users::get_wpl_data($this->user_id); /** import tpl **/ parent::render($this->tpl_path, $this->tpl); }
/** * Generate Text search field * @author Howard R <*****@*****.**> * @static * @param int $user_id */ public static function update_text_search_field($user_id) { $user_data = (array) wpl_users::get_wpl_user($user_id); /** get text_search fields **/ $fields = wpl_flex::get_fields('', 1, 2, 'text_search', '1'); $rendered = self::render_profile($user_data, $fields); $text_search_data = array(); foreach ($rendered as $data) { if (isset($data['type']) and !trim($data['type']) or isset($data['value']) and !trim($data['value'])) { continue; } /** default value **/ $value = isset($data['value']) ? $data['value'] : ''; $value2 = ''; $type = isset($data['type']) ? $data['type'] : ''; if ($type == 'text' or $type == 'textarea') { $value = $data['name'] . ' ' . $data['value']; } elseif ($type == 'locations' and isset($data['locations']) and is_array($data['locations'])) { $location_value = ''; foreach ($data['locations'] as $location_level => $value) { $location_value .= $data['keywords'][$location_level] . ' '; $abbr = wpl_locations::get_location_abbr_by_name($data['raw'][$location_level], $location_level); $name = wpl_locations::get_location_name_by_abbr($abbr, $location_level); $location_value .= $name . ' ' . ($name != $abbr ? $abbr . ' ' : NULL); } $location_value .= __('County', WPL_TEXTDOMAIN); $value = $location_value; } elseif (isset($data['value'])) { $value = $data['name'] . ' ' . $data['value']; if (is_numeric($data['value'])) { $value2 = $data['name'] . ' ' . wpl_global::number_to_word($data['value']); } } /** set value in text search data **/ $text_search_data[] = $value; if (trim($value2) != '') { $text_search_data[] = $value2; } } $column = 'textsearch'; if (wpl_global::check_multilingual_status()) { $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false); } wpl_db::set('wpl_users', $user_id, $column, implode(' ', wpl_db::escape($text_search_data))); }
/** * Displays the widget settings controls on the widget panel. * Make use of the get_field_id() and get_field_name() function * when creating your form elements. This handles the confusing stuff. */ public function form($instance) { $this->widget_id = $this->number; $this->kind = isset($instance['kind']) ? $instance['kind'] : 0; _wpl_import('libraries.flex'); /** add main scripts **/ wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-slider'); wp_enqueue_script('jquery-ui-button'); wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_script('jquery-ui-draggable'); wp_enqueue_script('jquery-ui-droppable'); wp_enqueue_script('jquery-effects-core'); /* Set up some default widget settings. */ if (!isset($instance['layout'])) { $instance = array('title' => __('Search', WPL_TEXTDOMAIN), 'layout' => 'default.php', 'data' => self::make_array_defaults(wpl_flex::get_fields('', 1, $this->kind, 'searchmod', 1))); $defaults = array(); $instance = wp_parse_args((array) $instance, $defaults); } $path = _wpl_import($this->wpl_backend_form, true, true); ob_start(); include $path; echo $output = ob_get_clean(); }
<div class="active-block"> <!--All active fields will be here--> </div> <div class="wpl-inactive-block-wp wpl-util-scrollbar-wrap"> <div class="wpl-util-scrollbar-frame"> <div class="inactive-block"> <!--All inactive fields will be here--> </div> </div> <div class="wpl-util-scrollbar-scroll wpl-util-scrollbar-bottom"> <div class="wpl-util-scrollbar-handler"></div> </div> </div> <div class="all-block"> <?php wpl_search_widget::generate_backend_fields(wpl_flex::get_fields($category->id, 1, $this->kind, 'searchmod', 1), $values); ?> </div> <div class="overlay-wp"> <div class="overlay-text"> <?php echo __('Drag Here', WPL_TEXTDOMAIN); ?> </div> </div> </div>
/** * Updates text search field * @author Howard <*****@*****.**> * @static * @param int $property_id */ public static function update_text_search_field($property_id) { $property_data = wpl_property::get_property_raw_data($property_id); /** get text_search fields **/ $fields = wpl_flex::get_fields('', 1, $property_data['kind'], 'text_search', '1'); $rendered = self::render_property($property_data, $fields); $text_search_data = array(); foreach ($rendered as $data) { if (!isset($data['type'])) { continue; } if (isset($data['type']) and !trim($data['type']) or isset($data['value']) and !trim($data['value'])) { continue; } /** default value **/ $value = isset($data['value']) ? $data['value'] : ''; $value2 = ''; $type = $data['type']; if ($type == 'text' or $type == 'textarea') { $value = $data['name'] . ' ' . $data['value']; } elseif ($type == 'neighborhood') { $value = $data['name'] . (isset($data['distance']) ? ' (' . $data['distance'] . ' ' . __('MINUTES', WPL_TEXTDOMAIN) . ' ' . __('BY', WPL_TEXTDOMAIN) . ' ' . $data['by'] . ')' : ''); } elseif ($type == 'feature') { $feature_value = $data['name']; if (isset($data['values'][0])) { $feature_value .= ' '; foreach ($data['values'] as $val) { $feature_value .= $val . ', '; } $feature_value = rtrim($feature_value, ', '); } $value = $feature_value; } elseif ($type == 'locations' and isset($data['locations']) and is_array($data['locations'])) { $location_value = ''; foreach ($data['locations'] as $location_level => $value) { $location_value .= $data['keywords'][$location_level] . ' '; $abbr = wpl_locations::get_location_abbr_by_name($data['raw'][$location_level], $location_level); $name = wpl_locations::get_location_name_by_abbr($abbr, $location_level); $location_value .= $name . ' ' . ($name != $abbr ? $abbr . ' ' : NULL); } $location_value .= __('County', WPL_TEXTDOMAIN); $value = $location_value; } elseif (isset($data['value'])) { $value = $data['name'] . ' ' . $data['value']; if (is_numeric($data['value'])) { $value2 = $data['name'] . ' ' . wpl_global::number_to_word($data['value']); } } /** set value in text search data **/ if (trim($value) != '') { $text_search_data[] = strip_tags($value); } if (trim($value2) != '') { $text_search_data[] = strip_tags($value2); } } $column = 'textsearch'; if (wpl_global::check_multilingual_status()) { $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false); } wpl_db::set('wpl_properties', $property_id, $column, wpl_db::escape(implode(' ', $text_search_data))); }
/** * Updates text search field * @author Howard <*****@*****.**> * @static * @param int $property_id */ public static function update_text_search_field($property_id) { $property_data = wpl_property::get_property_raw_data($property_id); $kind = wpl_property::get_property_kind($property_id); /** get text_search fields **/ $fields = wpl_flex::get_fields('', 1, $property_data['kind'], 'text_search', '1'); $rendered = self::render_property($property_data, $fields); $text_search_data = array(); foreach ($rendered as $data) { if (!isset($data['type'])) { continue; } if (isset($data['type']) and !trim($data['type']) or isset($data['value']) and !trim($data['value'])) { continue; } /** default value **/ $value = isset($data['value']) ? $data['value'] : ''; $value2 = ''; $type = $data['type']; if ($type == 'text' or $type == 'textarea') { $value = $data['name'] . ' ' . $data['value']; } elseif ($type == 'neighborhood') { $value = $data['name'] . (isset($data['distance']) ? ' (' . $data['distance'] . ' ' . __('MINUTES', WPL_TEXTDOMAIN) . ' ' . __('BY', WPL_TEXTDOMAIN) . ' ' . $data['by'] . ')' : ''); } elseif ($type == 'feature') { $feature_value = $data['name']; if (isset($data['values'][0])) { $feature_value .= ' '; foreach ($data['values'] as $val) { $feature_value .= $val . ', '; } $feature_value = rtrim($feature_value, ', '); } $value = $feature_value; } elseif ($type == 'locations' and isset($data['locations']) and is_array($data['locations'])) { $location_values = array(); foreach ($data['locations'] as $location_level => $value) { array_push($location_values, $data['keywords'][$location_level]); $abbr = wpl_locations::get_location_abbr_by_name($data['raw'][$location_level], $location_level); $name = wpl_locations::get_location_name_by_abbr($abbr, $location_level); $ex_space = explode(' ', $name); foreach ($ex_space as $value_raw) { array_push($location_values, $value_raw); } if ($name !== $abbr) { array_push($location_values, $abbr); } } /** Add all location fields to the location text search **/ $location_category = wpl_flex::get_category(NULL, " AND `kind`='{$kind}' AND `prefix`='ad'"); $location_fields = wpl_flex::get_fields($location_category->id, 1, $kind); foreach ($location_fields as $location_field) { if (!isset($rendered[$location_field->id])) { continue; } if (!trim($location_field->table_column)) { continue; } if (!isset($rendered[$location_field->id]['value']) or isset($rendered[$location_field->id]['value']) and !trim($rendered[$location_field->id]['value'])) { continue; } $ex_space = explode(' ', strip_tags($rendered[$location_field->id]['value'])); foreach ($ex_space as $value_raw) { array_push($location_values, $value_raw); } } $location_suffix_prefix = wpl_locations::get_location_suffix_prefix(); foreach ($location_suffix_prefix as $suffix_prefix) { array_push($location_values, $suffix_prefix); } $location_string = ''; $location_values = array_unique($location_values); foreach ($location_values as $location_value) { $location_string .= 'LOC-' . __($location_value, WPL_TEXTDOMAIN) . ' '; } $value = trim($location_string); } elseif (isset($data['value'])) { $value = $data['name'] . ' ' . $data['value']; if (is_numeric($data['value'])) { $value2 = $data['name'] . ' ' . wpl_global::number_to_word($data['value']); } } /** set value in text search data **/ if (trim($value) != '') { $text_search_data[] = strip_tags($value); } if (trim($value2) != '') { $text_search_data[] = strip_tags($value2); } } $column = 'textsearch'; if (wpl_global::check_multilingual_status()) { $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false); } wpl_db::set('wpl_properties', $property_id, $column, wpl_db::escape(implode(' ', $text_search_data))); }