private function shortcode_wizard() { _wpl_import('libraries.sort_options'); /** global settings **/ $this->settings = wpl_global::get_settings(); parent::render($this->tpl_path, 'shortcode_wizard'); }
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; }
/** * 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 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); }
private function get_locations($location_level, $parent, $current_location_id = '') { $location_data = wpl_locations::get_locations($location_level, $parent, ''); $location_settings = wpl_global::get_settings('3'); # location settings $res = count($location_data) ? 1 : 0; if (!is_numeric($parent)) { $res = 1; } $message = $res ? __('Fetched.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN); $data = $location_data; /** website is configured to use location text **/ if ($location_settings['location_method'] == 1 and ($location_level >= 3 or $location_level == 'zips')) { $html = '<input type="text" name="wpl_listing_location' . $location_level . '_select" id="wpl_listing_location' . $location_level . '_select" onchange="wpl_listing_location_change(\'' . $location_level . '\', this.value);" />'; } elseif ($location_settings['location_method'] == 2 or $location_settings['location_method'] == 1 and $location_level <= 2) { $html = '<select name="wpl_listing_location' . $location_level . '_select" id="wpl_listing_location' . $location_level . '_select" onchange="wpl_listing_location_change(\'' . $location_level . '\', this.value);">'; $html .= '<option value="0">' . __('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' => $data, 'html' => $html, 'keyword' => __($location_settings['location' . $location_level . '_keyword'], WPL_TEXTDOMAIN)); echo json_encode($response); exit; }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); if ($type == 'locations' and !$done_this) { /** import library **/ _wpl_import('libraries.locations'); $location_settings = wpl_global::get_settings('3'); # location settings switch ($field['type']) { case 'simple': if ($location_settings['location_method'] == 2) { $show = 'simple_location_database'; } else { $show = 'simple_location_text'; } break; default: $show = $field['type']; break; } /** Place-holder **/ $placeholder = (isset($field['extoption']) and trim($field['extoption'])) ? $field['extoption'] : $location_settings['locationzips_keyword'] . ', ' . $location_settings['location3_keyword'] . ', ' . $location_settings['location1_keyword']; $location_path = WPL_ABSPATH . DS . 'libraries' . DS . 'widget_search' . DS . 'frontend' . DS . 'location_items'; $location_files = array(); if (wpl_folder::exists($location_path)) { $location_files = wpl_folder::files($location_path, '.php$'); } foreach ($location_files as $location_file) { include $location_path . DS . $location_file; }
/** * Checks Realtyna billing credentials * @author Howard <*****@*****.**> * @static * @return array */ public static function check_realtyna_credentials() { /** import settings library **/ _wpl_import('libraries.settings'); $current_url = wpl_global::get_full_url(); $domain = wpl_global::domain($current_url); $settings = wpl_global::get_settings(); $phpver = phpversion(); $wplversion = wpl_global::wpl_version(); $wpversion = wpl_global::wp_version(); $username = $settings['realtyna_username']; $password = $settings['realtyna_password']; $POST = array('domain' => $domain, 'wpversion' => $wpversion, 'wplversion' => $wplversion, 'phpver' => $phpver, 'username' => urlencode($username), 'password' => urlencode($password), 'command' => 'check_credentials', 'format' => 'json'); $io_handler = 'http://billing.realtyna.com/io/io.php'; $result = wpl_global::get_web_page($io_handler, $POST); $answer = json_decode($result, true); /** saving status **/ $status = isset($answer['status']) ? $answer['status'] : 0; wpl_settings::save_setting('realtyna_verified', $status, 1); $message = $status ? __('Credentials verified.', WPL_TEXTDOMAIN) : __('Invalid credentials!', WPL_TEXTDOMAIN); $success = 1; return array('success' => $success, 'message' => $message, 'status' => $status); }
private function location_save($table_name, $table_column, $value, $item_id) { $location_settings = wpl_global::get_settings('3'); # location settings $location_level = str_replace('_id', '', $table_column); $location_level = substr($location_level, -1); if ($table_column == 'zip_id') { $location_level = 'zips'; } $location_data = wpl_locations::get_location($value, $location_level); $location_name_column = $location_level != 'zips' ? 'location' . $location_level . '_name' : 'zip_name'; /** update property location data **/ if ($location_settings['location_method'] == 2 or $location_settings['location_method'] == 1 and in_array($location_level, array(1, 2))) { $res = wpl_db::update($table_name, array($table_column => $value, $location_name_column => $location_data->name), 'id', $item_id); } else { $res = wpl_db::update($table_name, array($location_name_column => $value), 'id', $item_id); } $res = (int) $res; $message = $res ? __('Saved.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN); $data = NULL; $response = array('success' => $res, 'message' => $message, 'data' => $data); echo json_encode($response); exit; }
/** * Sets Dublin Core Meta Tags * @author Howard <*****@*****.**> * @return boolean */ public function dublincore() { $settings = wpl_global::get_settings(); $dc_status = isset($settings['dc_status']) ? $settings['dc_status'] : false; /** check status of geo tags **/ if (!$dc_status) { return false; } $current_link_url = wpl_global::get_full_url(); $html = wpl_html::getInstance(); /** WPL views and WordPress views (Page/Post) **/ if (trim($this->view) != '' and $dc_status == 2 or $dc_status == 1) { if (trim($settings['dc_coverage']) != '') { $html->set_custom_tag('<meta name="DC.coverage" content="' . $settings['dc_coverage'] . '" />'); } if (trim($settings['dc_contributor']) != '') { $html->set_custom_tag('<meta name="DC.contributor" content="' . $settings['dc_contributor'] . '" />'); } if (trim($settings['dc_publisher']) != '') { $html->set_custom_tag('<meta name="DC.publisher" content="' . $settings['dc_publisher'] . '" />'); } if (trim($settings['dc_copyright']) != '') { $html->set_custom_tag('<meta name="DC.rights" content="' . $settings['dc_copyright'] . '" />'); } if (trim($settings['dc_source']) != '') { $html->set_custom_tag('<meta name="DC.source" content="' . $settings['dc_source'] . '" />'); } if (trim($settings['dc_relation']) != '') { $html->set_custom_tag('<meta name="DC.relation" content="' . $settings['dc_relation'] . '" />'); } $html->set_custom_tag('<meta name="DC.type" content="Text" />'); $html->set_custom_tag('<meta name="DC.format" content="text/html" />'); $html->set_custom_tag('<meta name="DC.identifier" content="' . $current_link_url . '" />'); $locale = apply_filters('plugin_locale', get_locale(), WPL_TEXTDOMAIN); $html->set_custom_tag('<meta name="DC.language" scheme="RFC1766" content="' . $locale . '" />'); } if ($this->view == 'property_show') { $proeprty_id = wpl_request::getVar('pid'); $property_data = wpl_property::get_property_raw_data($proeprty_id); $user_data = (array) wpl_users::get_user($property_data['user_id']); $html->set_custom_tag('<meta name="DC.title" content="' . $this->property_page_title . '" />'); $html->set_custom_tag('<meta name="DC.subject" content="' . $this->property_page_title . '" />'); $html->set_custom_tag('<meta name="DC.description" content="' . $this->property_description . '" />'); $html->set_custom_tag('<meta name="DC.date" content="' . $property_data['add_date'] . '" />'); $html->set_custom_tag('<meta name="DC.creator" content="' . $user_data['data']->user_login . '" />'); } elseif ($this->view == 'profile_show') { $user_id = wpl_request::getVar('uid'); $user_data = (array) wpl_users::get_user($user_id); $html->set_custom_tag('<meta name="DC.title" content="' . $this->user_title . '" />'); $html->set_custom_tag('<meta name="DC.subject" content="' . $this->user_title . '" />'); $html->set_custom_tag('<meta name="DC.description" content="' . $this->user_description . '" />'); $html->set_custom_tag('<meta name="DC.date" content="' . $user_data['data']->user_registered . '" />'); $html->set_custom_tag('<meta name="DC.creator" content="' . $user_data['data']->user_login . '" />'); } elseif (is_single()) { $post_author_id = wpl_global::get_post_field('post_author'); $author_username = wpl_global::get_the_author_meta('user_login', $post_author_id); $html->set_custom_tag('<meta name="DC.title" content="' . wpl_global::get_the_title() . '" />'); $html->set_custom_tag('<meta name="DC.subject" content="' . wpl_global::get_the_title() . '" />'); $html->set_custom_tag('<meta name="DC.date" content="' . wpl_global::get_the_date() . '" />'); $html->set_custom_tag('<meta name="DC.creator" content="' . $author_username . '" />'); } }
/** * It changes dummy fields to WPL fields * @author Howard R <*****@*****.**> * @static * @param array $parameters */ public static function set_location_vars($parameters) { /** specific fields like country, state, city and ... **/ $location_fields = array(); $rendered_parameters = array(); /** add location fields to specific fields **/ $location_settings = wpl_global::get_settings('3'); # location settings foreach ($location_settings as $location_key => $location_value) { if (!strpos($location_key, '_keyword') or trim($location_value) == '') { continue; } $location_id = str_replace('location', '', str_replace('_keyword', '', $location_key)); if ($location_id != 'zips') { $location_fields['location' . $location_id . '_id'] = self::parse_field($location_value); } else { $location_fields['zip_id'] = self::parse_field($location_value); } } foreach ($parameters as $parameter) { $ex = explode(':', $parameter); if (count($ex) == 2) { $rendered_parameters[self::parse_field(urldecode($ex[0]))] = $ex[1]; } elseif (count($ex) == 3) { $rendered_parameters[self::parse_field(urldecode($ex[1]))] = $ex[2]; } } foreach ($location_fields as $column => $location_field) { if (!isset($rendered_parameters[$location_field])) { continue; } $location_id = str_replace('location', '', str_replace('_id', '', $column)); if ($location_id == 'zip') { $location_id = 'zips'; } $query = "SELECT `id` FROM `#__wpl_location" . $location_id . "` WHERE `name`='" . urldecode($rendered_parameters[$location_field]) . "' " . ($parent ? "AND `parent`='{$parent}'" : ''); $parent = wpl_db::select($query, 'loadResult'); wpl_request::setVar('sf_select_' . $column, $parent); } }