Permalink
Browse files

Add $use_amp to OSCOM::getLink() for html safe & argument separator

  • Loading branch information...
1 parent c271fe1 commit 913c0bac9ae3c768292dc05fa76c7cf26bc6ccaf @haraldpdl haraldpdl committed Feb 10, 2012
Showing with 13 additions and 3 deletions.
  1. +13 −3 osCommerce/OM/Core/OSCOM.php
@@ -208,10 +208,11 @@ public static function getRequestType() {
* @param string $connection The type of connection to use for the link. Values: NONSSL, SSL, AUTO. Default: NONSSL.
* @param bool $add_session_id Add the session ID to the link. Default: True.
* @param bool $search_engine_safe Use search engine safe URLs. Default: True.
+ * @param bool $use_amp Use html safe & as argument separator. Default: True. Since v3.0.3
* @return string The URL address.
*/
- public static function getLink($site = null, $application = null, $parameters = null, $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
+ public static function getLink($site = null, $application = null, $parameters = null, $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $use_amp = true) {
if ( empty($site) ) {
$site = static::getSite();
}
@@ -232,6 +233,10 @@ public static function getLink($site = null, $application = null, $parameters =
$search_engine_safe = true;
}
+ if ( !is_bool($use_amp) ) {
+ $use_amp = true;
+ }
+
// Wrapper for RPC links; RPC cannot perform cross domain requests
$real_site = ($site == 'RPC') ? $application : $site;
@@ -281,6 +286,8 @@ public static function getLink($site = null, $application = null, $parameters =
if ( ($search_engine_safe === true) && Registry::exists('osC_Services') && Registry::get('osC_Services')->isStarted('sefu') ) {
$link = str_replace(array('?', '&', '='), array('/', '/', ','), $link);
+ } elseif ( $use_amp === true ) {
+ $link = str_replace('&', '&', $link);
}
return $link;
@@ -310,6 +317,8 @@ public static function getPublicSiteLink($url, $parameters = null, $site = null)
$link = substr($link, 0, -1);
}
+ $link = str_replace('&', '&', $link);
+
return $link;
}
@@ -322,10 +331,11 @@ public static function getPublicSiteLink($url, $parameters = null, $site = null)
* @param string $connection The type of connection to use for the link. Values: NONSSL, SSL, AUTO. Default: NONSSL.
* @param bool $add_session_id Add the session ID to the link. Default: True.
* @param bool $search_engine_safe Use search engine safe URLs. Default: True.
+ * @param bool $use_amp Use html safe & as argument separator. Default: False. Since v3.0.3
* @return string The URL address.
*/
- public static function getRPCLink($site = null, $application = null, $parameters = null, $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
+ public static function getRPCLink($site = null, $application = null, $parameters = null, $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $use_amp = false) {
if ( empty($site) ) {
$site = static::getSite();
}
@@ -334,7 +344,7 @@ public static function getRPCLink($site = null, $application = null, $parameters
$application = static::getSiteApplication();
}
- return static::getLink('RPC', $site, $application . '&' . $parameters, $connection, $add_session_id, $search_engine_safe);
+ return static::getLink('RPC', $site, $application . '&' . $parameters, $connection, $add_session_id, $search_engine_safe, $use_amp);
}
public static function redirect($url) {

0 comments on commit 913c0ba

Please sign in to comment.