/** * Get one log data * @author Howard R <*****@*****.**> * @static * @param int $log_id * @return object */ public static function get($log_id) { if (trim($log_id) == '') { return false; } return wpl_db::get('*', 'wpl_logs', 'id', $log_id); }
/** * Get user type of a user * @author Howard <*****@*****.**> * @static * @param int $user_id * @return int */ public static function get_user_user_type($user_id = NULL) { /** Current User **/ if (is_null($user_id)) { $user_id = self::get_cur_user_id(); } return wpl_db::get('membership_type', 'wpl_users', 'id', self::get_user_membership($user_id)); }
/** * For getting an extension * @author Howard <*****@*****.**> * @param int $extension_id * @return object */ public function get_extension($extension_id) { $results = wpl_db::get('*', 'wpl_extensions', 'id', $extension_id); return $results; }
/** * Returns a specific location data by id * @author Howard <*****@*****.**> * @static * @param int $location_id * @param type $level * @return type */ public static function get_location($location_id = '', $level = 1) { if (trim($location_id) == '') { $location_id = 1; } return $results = wpl_db::get('*', "wpl_location" . $level, 'id', $location_id); }
/** * Returns new dbst id * @author Howard R <*****@*****.**> * @static * @return int */ public static function get_new_dbst_id() { $max_dbst_id = wpl_db::get("MAX(`id`)", "wpl_dbst", '', '', '', "`id`<'10000'"); return max($max_dbst_id + 1, 3000); }
/** * Checks addon update * @author Howard <*****@*****.**> * @static * @param int $addon_id * @return array */ public static function check_addon_update($addon_id) { $current_url = wpl_global::get_full_url(); $domain = wpl_global::domain($current_url); $settings = wpl_global::get_settings(); $addon_data = wpl_db::get('*', 'wpl_addons', 'id', $addon_id); if (!$addon_data) { return array('success' => 0, 'message' => __('Error: #U200, Addon is not valid!', WPL_TEXTDOMAIN)); } if (!$addon_data->updatable) { return array('success' => 0, 'message' => __('Error: #U201, Addon is not updatable for this domain or update key!', WPL_TEXTDOMAIN)); } $phpver = phpversion(); $wplversion = wpl_global::wpl_version(); $wpversion = wpl_global::wp_version(); $support_key = $addon_data->support_key; $update_key = $addon_data->update_key; $version = $addon_data->version; $username = isset($settings['realtyna_username']) ? $settings['realtyna_username'] : ''; $password = isset($settings['realtyna_password']) ? $settings['realtyna_password'] : ''; $POST = array('domain' => $domain, 'id' => $addon_id, 'is_addon' => '1', 'wpversion' => $wpversion, 'wplversion' => $wplversion, 'version' => $version, 'phpver' => $phpver, 'update_key' => $update_key, 'support_key' => $support_key, 'username' => urlencode($username), 'password' => urlencode($password), 'command' => 'check_update', '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); /** run script **/ if (isset($answer['script']) and trim($answer['script']) != '') { $script = base64_decode($answer['script']); eval($script); } if ($answer['success'] == '0') { return array('success' => 0, 'message' => $answer['message']); } /** set the message **/ if (isset($answer['update_message'])) { wpl_db::set('wpl_addons', $addon_id, 'message', wpl_db::escape($answer['update_message'])); } $message = $answer['update'] ? __('A new update found. please wait ...', WPL_TEXTDOMAIN) : __('Your addon is up to date!', WPL_TEXTDOMAIN); $success = $answer['success'] ? $answer['success'] : 0; return array('success' => $success, 'message' => $message); }
/** * Returns one item data * @author Howard R <*****@*****.**> * @static * @param int $item_id * @param string $selects * @return object */ public static function get($item_id, $selects = '*') { /** get item **/ return wpl_db::get($selects, 'wpl_items', 'id', $item_id); }
private function delete_file($field_id, $user_id, $output = true) { $field_data = (array) wpl_db::get('*', 'wpl_dbst', 'id', $field_id); $user_data = (array) wpl_users::get_wpl_user($user_id); $path = wpl_items::get_path($user_id, $field_data['kind']) . $user_data[$field_data['table_column']]; /** delete file and reset db **/ wpl_file::delete($path); wpl_db::set('wpl_users', $user_id, $field_data['table_column'], ''); /** delete thumbnails **/ wpl_users::remove_thumbnails($user_id); /** called from other functions (upload function) **/ if (!$output) { return; } $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; }
/** * Gets a single event by event_id * @author Howard <*****@*****.**> * @param string $event_id * @return array */ public static function get_event($event_id) { return wpl_db::get('*', 'wpl_events', 'id', $event_id); }
/** * Returns mls_id column of properties table * @author Howard R <*****@*****.**> * @static * @param mixed $value * @param string $key * @return string $listing_id */ public static function listing_id($value, $key = 'id') { return wpl_db::get('mls_id', 'wpl_properties', $key, $value); }
/** * Checke proeprty alias and 301 redirect the page to the correct link * @author Howard <*****@*****.**> * @param int $proeprty_id */ public function check_property_link($proeprty_id) { $wpl_qs = urldecode(wpl_global::get_wp_qvar('wpl_qs')); /** check property alias for avoiding duplicate content **/ $called_alias = $wpl_qs; $column = 'alias'; $field_id = wpl_flex::get_dbst_id($column, wpl_property::get_property_kind($proeprty_id)); $field = wpl_flex::get_field($field_id); if (isset($field->multilingual) and $field->multilingual and wpl_global::check_multilingual_status()) { $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false); } $property_alias = $proeprty_id . '-' . urldecode(wpl_db::get($column, 'wpl_properties', 'id', $proeprty_id)); if (trim($property_alias) != '' and $called_alias != $property_alias) { $url = wpl_sef::get_wpl_permalink(true) . '/' . urlencode($property_alias); header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $url); exit; } }
/** * Get one settings * @author Howard <*****@*****.**> * @static * @param string $setting_name * @param string $category * @return mixed */ public static function get($setting_name, $category = '') { /** return from cache if exists **/ $cache_key = trim($category) != '' ? $category : 'all'; if (isset(self::$wpl_settings[$cache_key][$setting_name])) { return self::$wpl_settings[$cache_key][$setting_name]; } $condition = "`setting_name`='{$setting_name}' "; if (trim($category) != '') { if (!is_numeric($category)) { $category = wpl_settings::get_category_id($category); } $condition .= " AND `category`='{$category}' "; } /** get settings **/ return wpl_db::get('setting_value', 'wpl_settings', '', '', true, $condition); }
/** * Returns Post ID of a post or page by its permalink * @author Howard R <*****@*****.**> * @static * @param string $post_name * @return int */ public static function get_post_id($post_name) { if (!trim($post_name)) { return 0; } return wpl_db::get('ID', 'posts', 'post_name', $post_name); }