/** * Returns User Profile Link * @author Howard R <*****@*****.**> * @static * @param int $user_id * @param int $target_id * @return string */ public static function get_profile_link($user_id = '', $target_id = 0) { /** fetch currenr user data if user id is empty **/ if (trim($user_id) == '') { $user_id = self::get_cur_user_id(); } $user_data = self::get_user($user_id); $home_type = wpl_global::get_wp_option('show_on_front', 'posts'); $home_id = wpl_global::get_wp_option('page_on_front', 0); if (!$target_id) { $target_id = wpl_request::getVar('wpltarget', 0); } if ($target_id) { $url = wpl_global::add_qs_var('uid', $user_id, wpl_sef::get_page_link($target_id)); if ($home_type == 'page' and $home_id == $target_id) { $url = wpl_global::add_qs_var('wplview', 'profile_show', $url); } } else { $url = wpl_sef::get_wpl_permalink(true); $nosef = wpl_sef::is_permalink_default(); $wpl_main_page_id = wpl_sef::get_wpl_main_page_id(); if ($nosef or $home_type == 'page' and $home_id == $wpl_main_page_id) { $url = wpl_global::add_qs_var('wplview', 'profile_show', $url); $url = wpl_global::add_qs_var('uid', $user_id, $url); } else { $url .= urlencode($user_data->data->user_login) . '/'; } } return $url; }
/** * Returns WPL permalink * @author Howard R <*****@*****.**> * @static * @return string */ public static function get_wpl_permalink($full = false) { $main_permalink = wpl_global::get_setting('main_permalink'); if (!is_numeric($main_permalink)) { $main_permalink = wpl_sef::get_post_id($main_permalink); } /** Multilingual **/ if (wpl_global::check_multilingual_status()) { _wpl_import('libraries.addon_pro'); $lang_permalink = wpl_addon_pro::get_lang_main_page(); if ($lang_permalink) { $main_permalink = $lang_permalink; } } if ($full) { $url = wpl_sef::get_page_link($main_permalink); /** make sure / character is added to the end of URL in case WordPress SEO permalink is enabled **/ $nosef = wpl_sef::is_permalink_default(); if (!$nosef) { $url = trim($url, '/') . '/'; } return $url; } return wpl_sef::get_post_name($main_permalink); }
/** * Returns PDF link of property * @author Howard <*****@*****.**> * @static * @param int $property_id * @param int $target_id * @return string|boolean */ public static function get_property_pdf_link($property_id, $target_id = 0) { /** first validation **/ if (!trim($property_id)) { return false; } $nosef = wpl_sef::is_permalink_default(); $home_type = wpl_global::get_wp_option('show_on_front', 'posts'); $home_id = wpl_global::get_wp_option('page_on_front', 0); $wpl_main_page_id = wpl_sef::get_wpl_main_page_id(); if ($nosef or $home_type == 'page' and $home_id == $wpl_main_page_id) { $url = wpl_sef::get_wpl_permalink(true); $url = wpl_global::add_qs_var('wplview', 'features', $url); $url = wpl_global::add_qs_var('wpltype', 'pdf', $url); $url = wpl_global::add_qs_var('pid', $property_id, $url); } else { $url = wpl_sef::get_wpl_permalink(true) . 'features/pdf?pid=' . $property_id; } return $url; }
/** * Returns RSS link of property listing * @author Steve A. <*****@*****.**> * @static * @return string|boolean */ public static function get_property_rss_link() { $nosef = wpl_sef::is_permalink_default(); $home_type = wpl_global::get_wp_option('show_on_front', 'posts'); $home_id = wpl_global::get_wp_option('page_on_front', 0); $wpl_main_page_id = wpl_sef::get_wpl_main_page_id(); if ($nosef or $home_type == 'page' and $home_id == $wpl_main_page_id) { $url = wpl_sef::get_wpl_permalink(true); $url = wpl_global::add_qs_var('wplview', 'features', $url); $url = wpl_global::add_qs_var('wpltype', 'rss', $url); } else { $url = wpl_sef::get_wpl_permalink(true) . 'features/rss'; } return $url; }