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); }
private function get_locations($location_level = '', $parent = '', $current_location_id = '', $widget_id) { $location_settings = wpl_global::get_settings('3'); # location settings if ($location_settings['zipcode_parent_level'] == $location_level - 1) { $location_level = 'zips'; } $location_data = wpl_locations::get_locations($location_level, $parent, $location_level == '1' ? 1 : ''); $res = count($location_data) ? 1 : 0; $message = $res ? __('Fetched.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN); $name_id = $location_level != 'zips' ? 'sf' . $widget_id . '_select_location' . $location_level . '_id' : 'sf' . $widget_id . '_select_zip_id'; $html = '<select name="' . $name_id . '" id="' . $name_id . '"'; if ($location_level != 'zips') { $html .= 'onchange="wpl' . $widget_id . '_search_widget_load_location(\'' . $location_level . '\', this.value, \'' . $current_location_id . '\');"'; } $html .= '>'; $html .= '<option value="-1">' . __(trim($location_settings['location' . $location_level . '_keyword']) != '' ? $location_settings['location' . $location_level . '_keyword'] : 'Select', WPL_TEXTDOMAIN) . '</option>'; foreach ($location_data as $location) { $html .= '<option value="' . $location->id . '" ' . ($current_location_id == $location->id ? 'selected="selected"' : '') . '>' . __($location->name, WPL_TEXTDOMAIN) . '</option>'; } $html .= '</select>'; $response = array('success' => $res, 'message' => $message, 'data' => $location_data, 'html' => $html, 'keyword' => __($location_settings['location' . $location_level . '_keyword'], WPL_TEXTDOMAIN)); echo json_encode($response); exit; }
private function shortcode_wizard() { _wpl_import('libraries.sort_options'); /** global settings **/ $this->settings = wpl_global::get_settings(); parent::render($this->tpl_path, 'shortcode_wizard'); }
public function start($layout, $params) { $room_types = wpl_global::return_in_id_array(wpl_room_types::get_room_types()); /** include layout **/ $layout_path = _wpl_import($layout, true, true); include $layout_path; }
public function display() { /** check permission **/ wpl_global::min_access('administrator'); $function = wpl_request::getVar('wpl_function'); if ($function == 'generate_new_page') { self::generate_new_page(); } elseif ($function == 'generate_delete_page') { self::generate_delete_page(); } elseif ($function == 'set_enabled_property_type') { $property_type_id = wpl_request::getVar('property_type_id'); $enabeled_status = wpl_request::getVar('enabeled_status'); self::set_enabled_property_type($property_type_id, $enabeled_status); } elseif ($function == 'remove_property_type') { $property_type_id = wpl_request::getVar('property_type_id'); $confirmed = wpl_request::getVar('wpl_confirmed', 0); self::remove_property_type($property_type_id, $confirmed); } elseif ($function == 'generate_edit_page') { $property_type_id = wpl_request::getVar('property_type_id'); self::generate_edit_page($property_type_id); } elseif ($function == 'sort_property_types') { $sort_ids = wpl_request::getVar('sort_ids'); self::sort_property_types($sort_ids); } elseif ($function == 'save_property_type') { self::save_property_type(); } elseif ($function == 'insert_property_type') { self::insert_property_type(); } elseif ($function == 'can_remove_property_type') { self::can_remove_property_type(); } elseif ($function == 'purge_related_property') { self::purge_related_property(); } elseif ($function == 'assign_related_properties') { self::assign_related_properties(); } }
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); }
private function save_params() { $table = wpl_request::getVar('table'); $id = wpl_request::getVar('id'); $post = wpl_request::get('post'); $keys = (isset($post['wpl_params']) and is_array($post['wpl_params']['keys'])) ? $post['wpl_params']['keys'] : array(); $values = (isset($post['wpl_params']) and is_array($post['wpl_params']['values'])) ? $post['wpl_params']['values'] : array(); $params = array(); foreach ($keys as $key => $value) { if (trim($value) == '') { continue; } $params[$value] = $values[$key]; } /** save params **/ wpl_global::set_params($table, $id, $params); /** trigger event **/ wpl_global::event_handler('params_saved', array('table' => $table, 'id' => $id, 'params' => $params)); $res = 1; $message = $res ? __('Params Saved.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN); $data = NULL; $response = array('success' => $res, 'message' => $message, 'data' => $data); echo json_encode($response); exit; }
public function display($instance = array()) { $this->uid = wpl_request::getVar('uid', 0); if (!$this->uid) { $this->uid = wpl_request::getVar('sf_select_user_id', 0); wpl_request::setVar('uid', $this->uid); } /** check user id **/ if (!$this->uid) { /** import message tpl **/ $this->message = __("No profile found or it's not available now!", WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message', false, true); } /** set the user id to search credentials **/ wpl_request::setVar('sf_select_user_id', $this->uid); /** set the kind **/ $this->kind = wpl_request::getVar('kind', '0'); wpl_request::setVar('kind', $this->kind); /** User Type **/ $this->user_type = wpl_users::get_user_user_type($this->uid); /** trigger event **/ wpl_global::event_handler('profile_show', array('id' => $this->uid, 'kind' => $this->kind)); /** import tpl **/ $this->tpl = wpl_users::get_user_type_tpl($this->tpl_path, $this->tpl, $this->user_type); /** import tpl **/ return parent::render($this->tpl_path, $this->tpl, false, true); }
public function display() { /** check permission **/ wpl_global::min_access('administrator'); $function = wpl_request::getVar('wpl_function'); if ($function == 'sort_rooms') { $sort_ids = wpl_request::getVar('sort_ids'); self::sort_rooms($sort_ids); } if ($function == 'generate_new_room_type') { self::generate_new_room_type(); } elseif ($function == 'room_types_enabled_state_change') { $id = wpl_request::getVar('id'); $enabled_status = wpl_request::getVar('enabled_status'); self::update('wpl_room_types', $id, 'enabled', $enabled_status); } elseif ($function == 'remove_room_type') { /** check permission **/ wpl_global::min_access('administrator'); $room_type_id = wpl_request::getVar('room_type_id'); $confirmed = wpl_request::getVar('wpl_confirmed', 0); self::remove_room_type($room_type_id, $confirmed); } elseif ($function == 'change_room_type_name') { $id = wpl_request::getVar('id'); $name = wpl_request::getVar('name'); self::update('wpl_room_types', $id, 'name', $name); } elseif ($function == 'save_room_type') { $name = wpl_request::getVar('name'); self::save_room_type($name); } }
public function generate_search_form() { $this->property_types = wpl_global::get_property_types(); $this->listings = wpl_global::get_listings(); $this->users = wpl_users::get_wpl_users(); parent::render($this->tpl_path, 'search_form'); }
public function show_help_tab($contextual_help, $screen_id, $screen) { /** Don't run if it's not WPL Page **/ if ($screen->parent_base != 'WPL_main_menu') { return; } $page = wpl_request::getVar('page', ''); /** First Validation **/ if (!trim($page)) { return false; } $tabs = array(); $path = _wpl_import('assets.helps.' . $page, true, true); if (wpl_file::exists($path)) { $tabs = (include_once $path); } /** No Help **/ if (!is_array($tabs) or is_array($tabs) and !count($tabs)) { return false; } $screen = get_current_screen(); foreach ($tabs['tabs'] as $tab) { /** Add Help Tab **/ $screen->add_help_tab(array('id' => $tab['id'], 'title' => $tab['title'], 'content' => $tab['content'])); } if (!isset($tabs['sidebar'])) { $tabs['sidebar'] = array('content' => '<a class="wpl_contextual_help_tour" href="' . wpl_global::add_qs_var('wpltour', 1) . '">' . __('Introduce Tour', WPL_TEXTDOMAIN) . '</a>'); } $screen->set_help_sidebar($tabs['sidebar']['content']); }
public function user_manager() { /** check permission **/ wpl_global::min_access('administrator'); $possible_orders = array('u.id', 'u.user_registered'); $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; $this->show_all = wpl_request::getVar('show_all', 0); $this->filter = wpl_request::getVar('filter', ''); $this->membership_id = wpl_request::getVar('membership_id', ''); $where_query = wpl_db::create_query(); if (trim($this->filter)) { $where_query = " AND (`user_login` LIKE '%" . $this->filter . "%' OR `user_email` LIKE '%" . $this->filter . "%' OR `first_name` LIKE '%" . $this->filter . "%' OR `last_name` LIKE '%" . $this->filter . "%')"; } if (trim($this->membership_id)) { $where_query = " AND `membership_id`='" . $this->membership_id . "'"; } $num_result = wpl_db::num("SELECT COUNT(u.ID) FROM `#__users` AS u " . ($this->show_all ? 'LEFT' : 'INNER') . " JOIN `#__wpl_users` AS wpl ON u.ID = wpl.id WHERE 1 {$where_query}"); $this->pagination = wpl_pagination::get_pagination($num_result, $page_size); $where_query .= " ORDER BY {$orderby} {$order} " . $this->pagination->limit_query; if ($this->show_all) { $this->wp_users = wpl_users::get_wp_users($where_query); } else { $this->wp_users = wpl_users::get_wpl_users($where_query); } $this->memberships = wpl_users::get_wpl_memberships(); /** import tpl **/ parent::render($this->tpl_path, $this->tpl); }
function __construct($username, $password, $vars, $settings) { /** smart set of settings **/ foreach ($settings as $setting => $setval) { if ($setval != '') { $this->settings[$setting] = $setval; } } // Authenticating if ($username != '') { $authenticate = wpl_users::authenticate($username, $password); if ($authenticate['status'] != 1) { $this->error = "ERROR: Authentication failed!"; return false; } $this->uid = $authenticate['uid']; } else { $this->uid = 0; } if (!wpl_global::check_access($this->settings['access_view'], $this->uid)) { $this->error = "ERROR: No access to the command!"; return false; } // Checking essential vars if (!isset($vars['pid']) or trim($vars['pid']) == '') { $this->error = "ERROR: No property id set!"; return false; } $this->pid = $vars['pid']; }
/** * Service runner * @author Howard <*****@*****.**> * @return void */ public function run() { /** recognizer **/ $recognizer = wpl_request::getVar('get_realtyna_platform', 0); if ($recognizer == 1) { exit('WPL'); } $format = wpl_request::getVar('wplformat', ''); $view = wpl_request::getVar('wplview', ''); /** if it's not IO request **/ if ($format != 'io' or $view != 'io') { return; } $wpl_settings = wpl_global::get_settings(); /** if IO is disabled **/ if (!$wpl_settings['io_status']) { return; } $dapikey = wpl_request::getVar('dapikey', ''); $dapisecret = wpl_request::getVar('dapisecret', ''); /** if API key or API secret is invalid **/ if ($dapikey != $wpl_settings['api_key'] or $dapisecret != $wpl_settings['api_secret']) { exit("ERROR: Signature is invalid."); } $cmd = wpl_request::getVar('cmd', ''); $io_object = new wpl_io_global(); $commands = $io_object->get_commands(); if (!in_array($cmd, $commands)) { exit("ERROR: Command not found."); } $dformat = wpl_request::getVar('dformat', 'json'); $dformats = $io_object->get_formats(); if (!in_array($dformat, $dformats)) { exit("ERROR: Format not found."); } $username = wpl_request::getVar('user'); $password = wpl_request::getVar('pass'); $dlang = wpl_request::getVar('dlang'); $gvars = wpl_request::get('GET'); $pvars = wpl_request::get('POST'); $vars = array_merge($pvars, $gvars); $response = $io_object->response($cmd, $username, $password, $vars, $dformat); /** Error **/ /* if(is_string($response)) { echo $response; exit; }*/ $rendered = $io_object->render_format($cmd, $vars, $response, $dformat); if (is_array($rendered)) { if ($rendered['header'] != '') { header($rendered['header']); } echo $rendered['output']; } else { echo $rendered; } exit; }
public function home() { /** check permission **/ wpl_global::min_access('administrator'); $this->setting_categories = wpl_settings::get_categories(); /** import tpl **/ parent::render($this->tpl_path, $this->tpl); }
public function admin_home() { /** check permission **/ wpl_global::min_access('administrator'); $this->submenus = wpl_global::get_menus('submenu', 'backend', 1, 1); $this->settings = wpl_global::get_settings(); /** import tpl **/ parent::render($this->tpl_path, $this->tpl); }
public function generate_room_types() { $tpl = 'internal_room_types'; $this->room_types = wpl_room_types::get_room_types("", ""); $folder = WPL_ABSPATH . 'assets' . DS . 'img' . DS . 'rooms'; $this->icons = wpl_global::get_icons($folder); /** import tpl **/ parent::render($this->tpl_path, $tpl); }
/** * Updates wpl_sort_options table * @author Howard <*****@*****.**> * @static * @param string $table * @param int $id * @param string $key * @param string $value * @return boolean */ public static function update($table = 'wpl_sort_options', $id, $key, $value = '') { /** first validation **/ if (trim($table) == '' or trim($id) == '' or trim($key) == '') { return false; } /** trigger event **/ wpl_global::event_handler('sort_options_updated', array('id' => $id, 'key' => $value)); return wpl_db::set($table, $id, $key, $value); }
public function home() { /** check permission **/ wpl_global::min_access('administrator'); // get list of all activity $this->activities = wpl_activity::get_activities('', '', ' ORDER BY `index` ASC, `ID` DESC'); $this->available_activities = wpl_activity::get_available_activities(); /** import tpl * */ parent::render($this->tpl_path, $this->tpl); }
public function display() { /** check permission **/ wpl_global::min_access('agent'); $function = wpl_request::getVar('wpl_function'); if ($function == 'save_room') { self::save_room(); } elseif ($function == 'delete_room') { self::delete_room(); } }
public function display() { /** check permission **/ wpl_global::min_access('administrator'); $function = wpl_request::getVar('wpl_function'); if ($function == 'set_enabled_notification') { $this->set_enabled_notification(); } elseif ($function == 'save_notification') { $this->save_notification(); } }
private function get_listing_types() { $listing_types = wpl_global::get_listings(); $enabled_listing_types = array(); foreach ($listing_types as $value) { if ($value['enabled_in_mobile'] == 1) { $enabled_listing_types[] = $value; } } return $enabled_listing_types; }
public function display() { /** check permission **/ wpl_global::min_access('administrator'); $function = wpl_request::getVar('wpl_function'); if ($function == 'generate_modify_page') { $field_id = wpl_request::getVar('field_id', 0); $field_type = wpl_request::getVar('field_type', 'text'); $kind = wpl_request::getVar('kind', 0); self::generate_modify_page($field_type, $field_id, $kind); } }
public function home() { /** check permission **/ wpl_global::min_access('administrator'); $this->tpl = wpl_request::getVar('tpl', 'default'); if ($this->tpl == 'modify') { $this->id = wpl_request::getVar('id', 0); $this->modify(); } else { $this->notifications = wpl_notifications::get_notifications(); parent::render($this->tpl_path, $this->tpl); } }
function build() { if (trim($this->error) == '' and !wpl_global::check_access($this->access, $this->uid)) { $this->error = "Access Error"; } if (trim($this->access) == '') { $this->error = "Empty Access"; } $this->status = trim($this->error) == '' ? 1 : 0; $this->message = trim($this->error) == '' ? 'Valid' : $this->error; $this->built = array('response' => array('status' => $this->status, 'message' => $this->message)); return $this->built; }
public function get_qr_image($qrfile_prefix = 'qr_', $size = 4, $outer_margin = 2) { $url = wpl_global::get_full_url(); $file_name = $qrfile_prefix . md5($url) . '.png'; $file_path = wpl_global::get_upload_base_path() . 'qrcode' . DS . $file_name; if (!wpl_file::exists($file_path)) { if (!wpl_file::exists(dirname($file_path))) { wpl_folder::create(dirname($file_path)); } $QRcode = new QRcode(); $QRcode->png($url, $file_path, 'L', $size, $outer_margin); } return wpl_global::get_upload_base_url() . 'qrcode/' . $file_name; }
public function home() { /** check permission **/ wpl_global::min_access('administrator'); $this->kind = trim(wpl_request::getVar('kind')) != '' ? wpl_request::getVar('kind') : 0; if (!in_array($this->kind, wpl_flex::get_valid_kinds())) { $this->message = __('Invalid Kind!', WPL_TEXTDOMAIN); /** import tpl **/ return parent::render($this->tpl_path, 'message'); } $this->field_categories = wpl_flex::get_categories(0, $this->kind); $this->kind_label = wpl_flex::get_kind_label($this->kind); $this->dbst_types = wpl_flex::get_dbst_types(1, $this->kind); $this->new_dbst_id = wpl_flex::get_new_dbst_id(); /** import tpl **/ parent::render($this->tpl_path, $this->tpl); }
public function display() { /** check permission **/ wpl_global::min_access('administrator'); $function = wpl_request::getVar('wpl_function'); if ($function == 'sort_options') { $sort_ids = wpl_request::getVar('sort_ids'); self::sort_options($sort_ids); } elseif ($function == 'sort_options_enabled_state_change') { $id = wpl_request::getVar('id'); $enabled_status = wpl_request::getVar('enabled_status'); self::update('wpl_sort_options', $id, 'enabled', $enabled_status); } elseif ($function == 'save_sort_option') { $id = wpl_request::getVar('id'); $sort_name = wpl_request::getVar('sort_name', ''); self::update('wpl_sort_options', $id, 'name', $sort_name); } }
/** * Constructor function * @author Howard R <*****@*****.**> * @param type $init */ public function __construct($init = true) { /** initialize html library **/ if ($init) { $html = $this->getInstance(false); $client = wpl_global::get_client(); add_filter('wp_title', array($html, 'title'), 9999, 2); add_action('wp_head', array($html, 'generate_head'), 9999); if ($client == 0) { /** SET WPL canonical **/ remove_action('wp_head', 'rel_canonical'); add_action('wp_head', array($html, 'generate_canonical'), 9999); add_action('wp_footer', array($html, 'generate_footer'), 9999); } elseif ($client == 1) { add_action('in_admin_footer', array($html, 'generate_footer'), 9999); } } }
public function display() { /** check permission * */ wpl_global::min_access('administrator'); $function = wpl_request::getVar('wpl_function'); if ($function == 'generate_modify_page') { $this->generate_modify_page(); } elseif ($function == 'sort_activities') { $this->sort_activities(wpl_request::getVar('sort_ids')); } elseif ($function == 'set_enabled_activity') { $this->set_enabled_activity(wpl_request::getVar('activity_id'), wpl_request::getVar('enabled_status')); } elseif ($function == 'remove_activity') { $this->remove_activity(wpl_request::getVar('activity_id'), wpl_request::getVar('wpl_confirmed', 0)); } elseif ($function == 'save_activity') { $this->save_activity(); } elseif ($function == 'load_options') { $this->load_options(wpl_request::getVar('activity_name'), wpl_request::getVar('activity_layout')); } }