private static function _getCompleteURL($url) { $path = JRoute::_($url, true); $jUri = JURI::getInstance(); $url = rtrim($jUri->toString(array('scheme', 'host', 'port')), '/'); // URL Encode the path only, but not the slashes within the path $url .= implode('/', array_map('urlencode', explode('/', $path))); $url = SCSocialUtilities::forceScheme($url); return $url; }
static function getStrippedUrl() { $href = SCSocialUtilities::forceScheme(JURI::current()); $juri = JURI::getInstance(); // Delete some common, unwanted query params to at least try to get at the canonical URL $juri->delVar('fb_comment_id'); $juri->delVar('tp'); $juri->delVar('notif_t'); $juri->delVar('ref'); $juri->delVar('utm_source'); $juri->delVar('utm_medium'); $juri->delVar('utm_campaign'); $juri->delVar('utm_term'); $juri->delVar('utm_content'); $juri->delVar('fb_source'); $juri->delVar('fb_action_ids'); $juri->delVar('fb_action_types'); $juri->delVar('fb_aggregation_id'); $query = $juri->getQuery(); if ($query) { $href .= '?' . $query; } return $href; }