From a3e55d9cd081881188d659d449e1b8d6fcfea3bf Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 6 Jan 2015 14:56:58 -0800 Subject: [PATCH] INFRA-132 - CRM/Utils - Misc --- CRM/Utils/Hook.php | 15 ++++++++++----- CRM/Utils/Hook/DrupalBase.php | 3 ++- CRM/Utils/Hook/Joomla.php | 3 ++- CRM/Utils/Hook/Soap.php | 3 ++- CRM/Utils/Hook/UnitTests.php | 3 ++- CRM/Utils/Migrate/ExportJSON.php | 20 +++++++++++--------- CRM/Utils/PDF/Utils.php | 3 ++- CRM/Utils/REST.php | 9 ++++++--- CRM/Utils/Recent.php | 3 ++- CRM/Utils/String.php | 3 ++- CRM/Utils/System.php | 12 ++++++++---- CRM/Utils/System/Drupal8.php | 6 ++++-- CRM/Utils/System/DrupalBase.php | 3 ++- CRM/Utils/System/Joomla.php | 3 ++- CRM/Utils/System/UnitTests.php | 3 ++- CRM/Utils/Token.php | 12 ++++++++---- CRM/Utils/Weight.php | 3 ++- 17 files changed, 69 insertions(+), 38 deletions(-) diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php index a8cf536cda..fa932a9b26 100644 --- a/CRM/Utils/Hook.php +++ b/CRM/Utils/Hook.php @@ -111,7 +111,8 @@ abstract class CRM_Utils_Hook { * * @return mixed */ - abstract function invoke($numParams, + abstract function invoke( + $numParams, &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, $fnSuffix ); @@ -129,7 +130,8 @@ abstract class CRM_Utils_Hook { * * @return array|bool */ - function commonInvoke($numParams, + function commonInvoke( + $numParams, &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, $fnSuffix, $fnPrefix ) { @@ -179,7 +181,8 @@ abstract class CRM_Utils_Hook { * * @return array|bool */ - function runHooks($civiModules, $fnSuffix, $numParams, + function runHooks( + $civiModules, $fnSuffix, $numParams, &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6 ) { // $civiModules is *not* passed by reference because runHooks @@ -654,7 +657,8 @@ abstract class CRM_Utils_Hook { * * @return null */ - static function tokenValues(&$details, + static function tokenValues( + &$details, $contactIDs, $jobID = NULL, $tokens = array(), @@ -893,7 +897,8 @@ abstract class CRM_Utils_Hook { * * @return mixed */ - static function alterPaymentProcessorParams($paymentObj, + static function alterPaymentProcessorParams( + $paymentObj, &$rawParams, &$cookedParams ) { diff --git a/CRM/Utils/Hook/DrupalBase.php b/CRM/Utils/Hook/DrupalBase.php index 6019cf8a2f..3ae3c1b045 100644 --- a/CRM/Utils/Hook/DrupalBase.php +++ b/CRM/Utils/Hook/DrupalBase.php @@ -75,7 +75,8 @@ class CRM_Utils_Hook_DrupalBase extends CRM_Utils_Hook { * * @return array|bool */ - function invoke($numParams, + function invoke( + $numParams, &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, $fnSuffix) { diff --git a/CRM/Utils/Hook/Joomla.php b/CRM/Utils/Hook/Joomla.php index 976ab038c8..b5792e673a 100644 --- a/CRM/Utils/Hook/Joomla.php +++ b/CRM/Utils/Hook/Joomla.php @@ -68,7 +68,8 @@ class CRM_Utils_Hook_Joomla extends CRM_Utils_Hook { * * @return mixed */ - function invoke($numParams, + function invoke( + $numParams, &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, $fnSuffix ) { diff --git a/CRM/Utils/Hook/Soap.php b/CRM/Utils/Hook/Soap.php index fc33752894..b1c63cedee 100644 --- a/CRM/Utils/Hook/Soap.php +++ b/CRM/Utils/Hook/Soap.php @@ -68,7 +68,8 @@ class CRM_Utils_Hook_Soap extends CRM_Utils_Hook { * * @return mixed */ - function invoke($numParams, + function invoke( + $numParams, &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, $fnSuffix ) { diff --git a/CRM/Utils/Hook/UnitTests.php b/CRM/Utils/Hook/UnitTests.php index cb26c88097..af2f01c4f2 100644 --- a/CRM/Utils/Hook/UnitTests.php +++ b/CRM/Utils/Hook/UnitTests.php @@ -106,7 +106,8 @@ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook { * * @return mixed */ - function invoke($numParams, + function invoke( + $numParams, &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, $fnSuffix) { diff --git a/CRM/Utils/Migrate/ExportJSON.php b/CRM/Utils/Migrate/ExportJSON.php index a481c7f31e..ed286b59a5 100644 --- a/CRM/Utils/Migrate/ExportJSON.php +++ b/CRM/Utils/Migrate/ExportJSON.php @@ -185,11 +185,12 @@ WHERE g.name IN ( $nameString ) * @param $whereField * @param null $additionalWhereCond */ - function table(&$ids, - $tableName, - &$fields, - $whereField, - $additionalWhereCond = NULL + function table( + &$ids, + $tableName, + &$fields, + $whereField, + $additionalWhereCond = NULL ) { if (empty($ids)) { return; @@ -589,9 +590,10 @@ WHERE ac.contact_id IN ( $ids ) * @param null $lastExportTime * @param bool $discoverContacts */ - function run($fileName, - $lastExportTime = NULL, - $discoverContacts = FALSE + function run( + $fileName, + $lastExportTime = NULL, + $discoverContacts = FALSE ) { $this->_discoverContacts = $discoverContacts; @@ -615,7 +617,7 @@ WHERE date >= $lastExportTime "; } - $dao = & CRM_Core_DAO::executeQuery($sql); + $dao = &CRM_Core_DAO::executeQuery($sql); $contactIDs = array(); while ($dao->fetch()) { diff --git a/CRM/Utils/PDF/Utils.php b/CRM/Utils/PDF/Utils.php index db9779fdab..9197ef0169 100644 --- a/CRM/Utils/PDF/Utils.php +++ b/CRM/Utils/PDF/Utils.php @@ -302,7 +302,8 @@ class CRM_Utils_PDF_Utils { * @param string $author * @param string $title */ - static function &pdflib($fileName, + static function &pdflib( + $fileName, $searchPath, &$values, $numPages = 1, diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index 1811dc5640..65068dd243 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -158,7 +158,8 @@ class CRM_Utils_REST { if (isset($result['count'])) { $count = ' count="' . $result['count'] . '" '; } - else { $count = ""; + else { + $count = ""; } $xml = " @@ -227,7 +228,8 @@ class CRM_Utils_REST { if ($inquote || $inarray) { $result .= $char; } - else { $result .= $char . $newline . str_repeat($tab, $tabcount); + else { + $result .= $char . $newline . str_repeat($tab, $tabcount); } break; @@ -426,7 +428,8 @@ class CRM_Utils_REST { } } if (array_key_exists('return', $requestParams) && is_array($requestParams['return'])) { - foreach ($requestParams['return'] as $key => $v) { $params['return.' . $key] = 1; + foreach ($requestParams['return'] as $key => $v) { + $params['return.' . $key] = 1; } } return $params; diff --git a/CRM/Utils/Recent.php b/CRM/Utils/Recent.php index de9c94e8d1..59e803fb24 100644 --- a/CRM/Utils/Recent.php +++ b/CRM/Utils/Recent.php @@ -98,7 +98,8 @@ class CRM_Utils_Recent { * @return void * @static */ - static function add($title, + static function add( + $title, $url, $id, $type, diff --git a/CRM/Utils/String.php b/CRM/Utils/String.php index e0df196d12..8b031fede1 100644 --- a/CRM/Utils/String.php +++ b/CRM/Utils/String.php @@ -576,7 +576,8 @@ class CRM_Utils_String { * @return string the sanitized string * @static */ - static function stripPathChars($string, + static function stripPathChars( + $string, $search = NULL, $replace = NULL ) { diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index 4291abb693..da938cb2c1 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -262,7 +262,8 @@ class CRM_Utils_System { * * @return string */ - static function href($text, $path = NULL, $query = NULL, $absolute = TRUE, + static function href( + $text, $path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL, $htmlize = TRUE, $frontend = FALSE, $forceBackend = FALSE ) { $url = self::url($path, $query, $absolute, $fragment, $htmlize, $frontend, $forceBackend); @@ -805,7 +806,8 @@ class CRM_Utils_System { * @param bool $output * @param string $disposition */ - static function download($name, $mimeType, &$buffer, + static function download( + $name, $mimeType, &$buffer, $ext = NULL, $output = TRUE, $disposition = 'attachment' @@ -1646,7 +1648,8 @@ class CRM_Utils_System { * * @return string $url, formatted url. */ - static function languageNegotiationURL($url, + static function languageNegotiationURL( + $url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE ) { @@ -1667,7 +1670,8 @@ class CRM_Utils_System { * (optional) Sent by contribution/event reg/profile pages which uses a id * specific extra file name if present. */ - static function appendTPLFile($fileName, + static function appendTPLFile( + $fileName, &$content, $overideFileName = NULL ) { diff --git a/CRM/Utils/System/Drupal8.php b/CRM/Utils/System/Drupal8.php index f1de352bf6..b4ebc51347 100644 --- a/CRM/Utils/System/Drupal8.php +++ b/CRM/Utils/System/Drupal8.php @@ -563,8 +563,10 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase { */ public function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) { static $run_once = FALSE; - if ($run_once) { return TRUE; - } else { $run_once = TRUE; + if ($run_once) { + return TRUE; + } else { + $run_once = TRUE; } if (!($root = $this->cmsRootPath())) { diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index 289dcd2dea..9884f47dcc 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -163,7 +163,8 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { * @return string an HTML string containing a link to the given path. * */ - function url($path = NULL, $query = NULL, $absolute = FALSE, + function url( + $path = NULL, $query = NULL, $absolute = FALSE, $fragment = NULL, $htmlize = TRUE, $frontend = FALSE, $forceBackend = FALSE ) { diff --git a/CRM/Utils/System/Joomla.php b/CRM/Utils/System/Joomla.php index 0fb75eaab3..de314ec906 100644 --- a/CRM/Utils/System/Joomla.php +++ b/CRM/Utils/System/Joomla.php @@ -357,7 +357,8 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { * * @return string an HTML string containing a link to the given path. */ - function url($path = NULL, $query = NULL, $absolute = TRUE, + function url( + $path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL, $htmlize = TRUE, $frontend = FALSE, $forceBackend = FALSE ) { diff --git a/CRM/Utils/System/UnitTests.php b/CRM/Utils/System/UnitTests.php index f540600252..398fd221e0 100644 --- a/CRM/Utils/System/UnitTests.php +++ b/CRM/Utils/System/UnitTests.php @@ -183,7 +183,8 @@ class CRM_Utils_System_UnitTests extends CRM_Utils_System_Drupal { * * @return string */ - function url($path = NULL, $query = NULL, $absolute = FALSE, + function url( + $path = NULL, $query = NULL, $absolute = FALSE, $fragment = NULL, $htmlize = TRUE, $frontend = FALSE, $forceBackend = FALSE ) { diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index 937c2a7d7c..e96b894d21 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -928,7 +928,8 @@ class CRM_Utils_Token { * @return string The processed string * @static */ - public static function &replaceResubscribeTokens($str, &$domain, &$groups, $html, + public static function &replaceResubscribeTokens( + $str, &$domain, &$groups, $html, $contact_id, $hash ) { if (self::token_match('resubscribe', 'group', $str)) { @@ -1162,7 +1163,8 @@ class CRM_Utils_Token { * @return array * @static */ - static function getTokenDetails($contactIDs, + static function getTokenDetails( + $contactIDs, $returnProperties = NULL, $skipOnHold = TRUE, $skipDeceased = TRUE, @@ -1289,7 +1291,8 @@ class CRM_Utils_Token { * @param string $jobID * @return array contactDetails with hooks swapped out */ - public function getAnonymousTokenDetails($contactIDs = array(0), + public function getAnonymousTokenDetails($contactIDs = array( + 0), $returnProperties = NULL, $skipOnHold = TRUE, $skipDeceased = TRUE, @@ -1324,7 +1327,8 @@ class CRM_Utils_Token { * @return array * @static */ - static function getContributionTokenDetails($contributionIDs, + static function getContributionTokenDetails( + $contributionIDs, $returnProperties = NULL, $extraParams = NULL, $tokens = array(), diff --git a/CRM/Utils/Weight.php b/CRM/Utils/Weight.php index 4fc7659087..519eb96612 100644 --- a/CRM/Utils/Weight.php +++ b/CRM/Utils/Weight.php @@ -290,7 +290,8 @@ class CRM_Utils_Weight { * * @return CRM_Core_DAO objet that holds the results of the query */ - static function &query($queryType, + static function &query( + $queryType, $daoName, $fieldValues = NULL, $queryData, -- 2.25.1