From 72b140cf1ee7995352d2a013a4d8aade71d370f2 Mon Sep 17 00:00:00 2001 From: Eileen Date: Sat, 4 Jan 2014 12:32:38 +1300 Subject: [PATCH] CRM-13492 d6 & d7 url functions are identical except for one missing param on d6, move d7 to DrupalBase, delete d6 & d7 versions ---------------------------------------- * CRM-13492: buildAmount Hook functionality changed -- difficult to use / undocumented http://issues.civicrm.org/jira/browse/CRM-13492 --- CRM/Utils/System/Drupal.php | 74 -------------------------------- CRM/Utils/System/Drupal6.php | 75 -------------------------------- CRM/Utils/System/DrupalBase.php | 76 +++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 149 deletions(-) diff --git a/CRM/Utils/System/Drupal.php b/CRM/Utils/System/Drupal.php index 16caf9e38c..23ea8ee70e 100644 --- a/CRM/Utils/System/Drupal.php +++ b/CRM/Utils/System/Drupal.php @@ -435,80 +435,6 @@ class CRM_Utils_System_Drupal extends CRM_Utils_System_DrupalBase { return $this->url($_GET['q']); } - /** - * Generate an internal CiviCRM URL (copied from DRUPAL/includes/common.inc#url) - * - * @param $path string The path being linked to, such as "civicrm/add" - * @param $query string A query string to append to the link. - * @param $absolute boolean Whether to force the output to be an absolute link (beginning with http:). - * Useful for links that will be displayed outside the site, such as in an - * RSS feed. - * @param $fragment string A fragment identifier (named anchor) to append to the link. - * @param $htmlize boolean whether to convert to html eqivalant - * @param $frontend boolean a gross joomla hack - * - * @return string an HTML string containing a link to the given path. - * @access public - * - */ - function url($path = NULL, $query = NULL, $absolute = FALSE, - $fragment = NULL, $htmlize = TRUE, - $frontend = FALSE, $forceBackend = FALSE - ) { - $config = CRM_Core_Config::singleton(); - $script = 'index.php'; - - $path = CRM_Utils_String::stripPathChars($path); - - if (isset($fragment)) { - $fragment = '#' . $fragment; - } - - if (!isset($config->useFrameworkRelativeBase)) { - $base = parse_url($config->userFrameworkBaseURL); - $config->useFrameworkRelativeBase = $base['path']; - } - $base = $absolute ? $config->userFrameworkBaseURL : $config->useFrameworkRelativeBase; - - $separator = $htmlize ? '&' : '&'; - - if (!$config->cleanURL) { - if (isset($path)) { - if (isset($query)) { - return $base . $script . '?q=' . $path . $separator . $query . $fragment; - } - else { - return $base . $script . '?q=' . $path . $fragment; - } - } - else { - if (isset($query)) { - return $base . $script . '?' . $query . $fragment; - } - else { - return $base . $fragment; - } - } - } - else { - if (isset($path)) { - if (isset($query)) { - return $base . $path . '?' . $query . $fragment; - } - else { - return $base . $path . $fragment; - } - } - else { - if (isset($query)) { - return $base . $script . '?' . $query . $fragment; - } - else { - return $base . $fragment; - } - } - } - } /** * Authenticate the user against the drupal db diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index e5b6a1d66d..54bc32d49e 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -436,81 +436,6 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { return $this->url($_GET['q']); } - /** - * Generate an internal CiviCRM URL (copied from DRUPAL/includes/common.inc#url) - * - * @param $path string The path being linked to, such as "civicrm/add" - * @param $query string A query string to append to the link. - * @param $absolute boolean Whether to force the output to be an absolute link (beginning with http:). - * Useful for links that will be displayed outside the site, such as in an - * RSS feed. - * @param $fragment string A fragment identifier (named anchor) to append to the link. - * @param $htmlize boolean whether to convert to html eqivalant - * @param $frontend boolean a gross joomla hack - * - * @return string an HTML string containing a link to the given path. - * @access public - * - */ - function url($path = NULL, $query = NULL, $absolute = FALSE, - $fragment = NULL, $htmlize = TRUE, - $frontend = FALSE - ) { - $config = CRM_Core_Config::singleton(); - $script = 'index.php'; - - $path = CRM_Utils_String::stripPathChars($path); - - if (isset($fragment)) { - $fragment = '#' . $fragment; - } - - if (!isset($config->useFrameworkRelativeBase)) { - $base = parse_url($config->userFrameworkBaseURL); - $config->useFrameworkRelativeBase = $base['path']; - } - $base = $absolute ? $config->userFrameworkBaseURL : $config->useFrameworkRelativeBase; - - $separator = $htmlize ? '&' : '&'; - - if (!$config->cleanURL) { - if (isset($path)) { - if (isset($query)) { - return $base . $script . '?q=' . $path . $separator . $query . $fragment; - } - else { - return $base . $script . '?q=' . $path . $fragment; - } - } - else { - if (isset($query)) { - return $base . $script . '?' . $query . $fragment; - } - else { - return $base . $fragment; - } - } - } - else { - if (isset($path)) { - if (isset($query)) { - return $base . $path . '?' . $query . $fragment; - } - else { - return $base . $path . $fragment; - } - } - else { - if (isset($query)) { - return $base . $script . '?' . $query . $fragment; - } - else { - return $base . $fragment; - } - } - } - } - /** * Authenticate the user against the drupal db * diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index 84c4254fe7..e8b5a82375 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -122,4 +122,80 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { } return $url; } + + /** + * Generate an internal CiviCRM URL (copied from DRUPAL/includes/common.inc#url) + * + * @param $path string The path being linked to, such as "civicrm/add" + * @param $query string A query string to append to the link. + * @param $absolute boolean Whether to force the output to be an absolute link (beginning with http:). + * Useful for links that will be displayed outside the site, such as in an + * RSS feed. + * @param $fragment string A fragment identifier (named anchor) to append to the link. + * @param $htmlize boolean whether to convert to html eqivalant + * @param $frontend boolean a gross joomla hack + * @param $forceBackend boolean a gross joomla hack + * + * @return string an HTML string containing a link to the given path. + * @access public + * + */ + function url($path = NULL, $query = NULL, $absolute = FALSE, + $fragment = NULL, $htmlize = TRUE, + $frontend = FALSE, $forceBackend = FALSE + ) { + $config = CRM_Core_Config::singleton(); + $script = 'index.php'; + + $path = CRM_Utils_String::stripPathChars($path); + + if (isset($fragment)) { + $fragment = '#' . $fragment; + } + + if (!isset($config->useFrameworkRelativeBase)) { + $base = parse_url($config->userFrameworkBaseURL); + $config->useFrameworkRelativeBase = $base['path']; + } + $base = $absolute ? $config->userFrameworkBaseURL : $config->useFrameworkRelativeBase; + + $separator = $htmlize ? '&' : '&'; + + if (!$config->cleanURL) { + if (isset($path)) { + if (isset($query)) { + return $base . $script . '?q=' . $path . $separator . $query . $fragment; + } + else { + return $base . $script . '?q=' . $path . $fragment; + } + } + else { + if (isset($query)) { + return $base . $script . '?' . $query . $fragment; + } + else { + return $base . $fragment; + } + } + } + else { + if (isset($path)) { + if (isset($query)) { + return $base . $path . '?' . $query . $fragment; + } + else { + return $base . $path . $fragment; + } + } + else { + if (isset($query)) { + return $base . $script . '?' . $query . $fragment; + } + else { + return $base . $fragment; + } + } + } + } } -- 2.25.1