From 50bfb46054c0ccd0f836a569c5417969da3c1a53 Mon Sep 17 00:00:00 2001 From: Saurabh Batra Date: Sat, 3 Oct 2015 17:32:40 +0530 Subject: [PATCH] Comment fixes for CRM/Utils directory --- CRM/Utils/API/AbstractFieldCoder.php | 6 +- CRM/Utils/API/HTMLInputCoder.php | 2 - CRM/Utils/API/MatchOption.php | 7 +- CRM/Utils/API/NullOutputCoder.php | 3 +- CRM/Utils/API/ReloadOption.php | 5 +- CRM/Utils/Address.php | 3 +- CRM/Utils/Address/BatchUpdate.php | 7 +- CRM/Utils/Address/USPS.php | 3 - CRM/Utils/Array.php | 4 +- CRM/Utils/AutoClean.php | 9 ++- CRM/Utils/Cache.php | 3 - CRM/Utils/Cache/APCcache.php | 2 - CRM/Utils/Cache/ArrayCache.php | 31 +++++++++ CRM/Utils/Cache/Memcache.php | 2 - CRM/Utils/Cache/Memcached.php | 2 - CRM/Utils/Cache/NoCache.php | 2 - CRM/Utils/Cache/SerializeCache.php | 50 ++++++++------ CRM/Utils/Cache/SqlGroup.php | 2 - CRM/Utils/Check.php | 9 +-- CRM/Utils/Check/Case.php | 2 - CRM/Utils/Check/Env.php | 4 +- CRM/Utils/Check/Message.php | 2 - CRM/Utils/Check/Security.php | 14 ++-- CRM/Utils/Constant.php | 6 ++ CRM/Utils/Crypt.php | 2 - CRM/Utils/Date.php | 33 ++++----- CRM/Utils/DeprecatedUtils.php | 100 ++++++++++++++------------- CRM/Utils/FakeObject.php | 31 +++++++++ CRM/Utils/File.php | 26 +++---- CRM/Utils/Geocode.php | 6 ++ CRM/Utils/Geocode/Google.php | 2 - CRM/Utils/Geocode/Yahoo.php | 2 - CRM/Utils/GlobalStack.php | 6 ++ CRM/Utils/Hook.php | 12 ++-- CRM/Utils/Hook/Drupal.php | 2 - CRM/Utils/Hook/Drupal6.php | 2 - CRM/Utils/Hook/Drupal8.php | 2 - CRM/Utils/Hook/DrupalBase.php | 2 - CRM/Utils/Hook/Joomla.php | 2 - CRM/Utils/Hook/Soap.php | 2 - CRM/Utils/Hook/UnitTests.php | 4 +- CRM/Utils/Hook/WordPress.php | 86 ++++++++++------------- CRM/Utils/Http.php | 30 ++++++++ CRM/Utils/HttpClient.php | 9 ++- CRM/Utils/JS.php | 2 - CRM/Utils/JSON.php | 10 ++- CRM/Utils/Mail.php | 20 +++--- CRM/Utils/Mail/Incoming.php | 2 - CRM/Utils/Migrate/Export.php | 2 - CRM/Utils/Migrate/ExportJSON.php | 8 +-- CRM/Utils/Migrate/Import.php | 2 +- CRM/Utils/Migrate/ImportJSON.php | 6 +- CRM/Utils/Money.php | 2 - CRM/Utils/Network.php | 3 - CRM/Utils/Number.php | 35 +++++++++- CRM/Utils/OpenFlashChart.php | 18 +++-- CRM/Utils/OptionBag.php | 80 +++++++++++++-------- CRM/Utils/PDF/Label.php | 5 +- CRM/Utils/PDF/Utils.php | 2 - CRM/Utils/Pager.php | 12 ++-- CRM/Utils/PagerAToZ.php | 10 +-- CRM/Utils/PseudoConstant.php | 8 ++- CRM/Utils/QueryFormatter.php | 8 ++- CRM/Utils/REST.php | 13 ++-- CRM/Utils/ReCAPTCHA.php | 5 +- CRM/Utils/Recent.php | 3 +- CRM/Utils/Request.php | 5 +- CRM/Utils/Rule.php | 16 ++--- CRM/Utils/Signer.php | 5 +- CRM/Utils/SoapServer.php | 2 +- CRM/Utils/Sort.php | 12 +--- CRM/Utils/String.php | 22 +++--- CRM/Utils/Sunlight.php | 2 - CRM/Utils/System.php | 23 ++---- CRM/Utils/SystemLogger.php | 3 - CRM/Utils/Time.php | 10 ++- CRM/Utils/Token.php | 50 +++++++------- CRM/Utils/Tree.php | 6 -- CRM/Utils/Type.php | 2 - CRM/Utils/Verp.php | 2 - CRM/Utils/VersionCheck.php | 2 - CRM/Utils/Weight.php | 16 ++--- CRM/Utils/XML.php | 1 - CRM/Utils/Zip.php | 12 ++-- 84 files changed, 518 insertions(+), 470 deletions(-) diff --git a/CRM/Utils/API/AbstractFieldCoder.php b/CRM/Utils/API/AbstractFieldCoder.php index e6f078b058..c012b571cc 100644 --- a/CRM/Utils/API/AbstractFieldCoder.php +++ b/CRM/Utils/API/AbstractFieldCoder.php @@ -31,8 +31,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ require_once 'api/Wrapper.php'; @@ -94,7 +92,7 @@ abstract class CRM_Utils_API_AbstractFieldCoder implements API_Wrapper { public abstract function decodeOutput(&$values); /** - * @inheritDoc + * {@inheritDoc} */ public function fromApiInput($apiRequest) { $lowerAction = strtolower($apiRequest['action']); @@ -119,7 +117,7 @@ abstract class CRM_Utils_API_AbstractFieldCoder implements API_Wrapper { } /** - * @inheritDoc + * {@inheritDoc} */ public function toApiOutput($apiRequest, $result) { $lowerAction = strtolower($apiRequest['action']); diff --git a/CRM/Utils/API/HTMLInputCoder.php b/CRM/Utils/API/HTMLInputCoder.php index 153daeac39..309ddf6829 100644 --- a/CRM/Utils/API/HTMLInputCoder.php +++ b/CRM/Utils/API/HTMLInputCoder.php @@ -36,8 +36,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_API_HTMLInputCoder extends CRM_Utils_API_AbstractFieldCoder { private $skipFields = NULL; diff --git a/CRM/Utils/API/MatchOption.php b/CRM/Utils/API/MatchOption.php index 6249fd878d..099f2d7d32 100644 --- a/CRM/Utils/API/MatchOption.php +++ b/CRM/Utils/API/MatchOption.php @@ -50,7 +50,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ */ require_once 'api/Wrapper.php'; @@ -76,7 +75,7 @@ class CRM_Utils_API_MatchOption implements API_Wrapper { } /** - * @inheritDoc + * {@inheritDoc} */ public function fromApiInput($apiRequest) { @@ -126,7 +125,7 @@ class CRM_Utils_API_MatchOption implements API_Wrapper { break; default: - // be forgiveful of sloppily api calls + // be forgiving of sloppy api calls } } @@ -164,7 +163,7 @@ class CRM_Utils_API_MatchOption implements API_Wrapper { } /** - * @inheritDoc + * {@inheritDoc} */ public function toApiOutput($apiRequest, $result) { return $result; diff --git a/CRM/Utils/API/NullOutputCoder.php b/CRM/Utils/API/NullOutputCoder.php index 46054e90a5..b28e5b4a86 100644 --- a/CRM/Utils/API/NullOutputCoder.php +++ b/CRM/Utils/API/NullOutputCoder.php @@ -31,7 +31,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ */ require_once 'api/Wrapper.php'; @@ -86,7 +85,7 @@ class CRM_Utils_API_NullOutputCoder extends CRM_Utils_API_AbstractFieldCoder { } /** - * @inheritDoc + * {@inheritDoc} */ /** * @param $apiRequest diff --git a/CRM/Utils/API/ReloadOption.php b/CRM/Utils/API/ReloadOption.php index b73c662919..509927f7ff 100644 --- a/CRM/Utils/API/ReloadOption.php +++ b/CRM/Utils/API/ReloadOption.php @@ -39,7 +39,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ */ require_once 'api/Wrapper.php'; @@ -65,14 +64,14 @@ class CRM_Utils_API_ReloadOption implements API_Wrapper { } /** - * @inheritDoc + * {@inheritDoc} */ public function fromApiInput($apiRequest) { return $apiRequest; } /** - * @inheritDoc + * {@inheritDoc} */ public function toApiOutput($apiRequest, $result) { $reloadMode = NULL; diff --git a/CRM/Utils/Address.php b/CRM/Utils/Address.php index b9c6230a54..6656f34e25 100644 --- a/CRM/Utils/Address.php +++ b/CRM/Utils/Address.php @@ -26,9 +26,10 @@ */ /** - * Address utilties + * Address Utilities * * @package CRM + * @copyright CiviCRM LLC (c) 2004-2015 */ class CRM_Utils_Address { diff --git a/CRM/Utils/Address/BatchUpdate.php b/CRM/Utils/Address/BatchUpdate.php index 47d4ce5ae1..102c85a471 100644 --- a/CRM/Utils/Address/BatchUpdate.php +++ b/CRM/Utils/Address/BatchUpdate.php @@ -25,12 +25,17 @@ +--------------------------------------------------------------------+ */ +/** + * + * @package CRM + * @copyright CiviCRM LLC (c) 2004-2015 + */ + /** * A PHP cron script to format all the addresses in the database. Currently * it only does geocoding if the geocode values are not set. At a later * stage we will also handle USPS address cleanup and other formatting * issues - * */ class CRM_Utils_Address_BatchUpdate { diff --git a/CRM/Utils/Address/USPS.php b/CRM/Utils/Address/USPS.php index c8d2493234..6d237b992a 100644 --- a/CRM/Utils/Address/USPS.php +++ b/CRM/Utils/Address/USPS.php @@ -26,11 +26,8 @@ */ /** - * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** diff --git a/CRM/Utils/Array.php b/CRM/Utils/Array.php index e5835dadbe..57c03e1391 100644 --- a/CRM/Utils/Array.php +++ b/CRM/Utils/Array.php @@ -407,7 +407,7 @@ class CRM_Utils_Array { $look = $reverse ? array_flip($lookup) : $lookup; - //trim lookup array, ignore . ( fix for CRM-1514 ), eg for prefix/suffix make sure Dr. and Dr both are valid + // trim lookup array, ignore . ( fix for CRM-1514 ), eg for prefix/suffix make sure Dr. and Dr both are valid $newLook = array(); foreach ($look as $k => $v) { $newLook[trim($k, ".")] = $v; @@ -866,7 +866,7 @@ class CRM_Utils_Array { /** * Diff multidimensional arrays - * ( array_diff does not support multidimensional array) + * (array_diff does not support multidimensional array) * * @param array $array1 * @param array $array2 diff --git a/CRM/Utils/AutoClean.php b/CRM/Utils/AutoClean.php index f647220780..0e8c7967f3 100644 --- a/CRM/Utils/AutoClean.php +++ b/CRM/Utils/AutoClean.php @@ -1,4 +1,5 @@ -
  • ' . implode('
  • ', $statusMessages) . '
  • '; } - // TODO: add link to status page + // @todo add link to status page CRM_Core_Session::setStatus($statusMessage, $statusTitle, $statusType); } } diff --git a/CRM/Utils/Check/Case.php b/CRM/Utils/Check/Case.php index 493bbbab10..3a5c3f0326 100644 --- a/CRM/Utils/Check/Case.php +++ b/CRM/Utils/Check/Case.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Check_Case { diff --git a/CRM/Utils/Check/Env.php b/CRM/Utils/Check/Env.php index f462702f26..86ebbd0642 100644 --- a/CRM/Utils/Check/Env.php +++ b/CRM/Utils/Check/Env.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Check_Env { @@ -281,7 +279,7 @@ class CRM_Utils_Check_Env { else { $vNum = $vc->localVersion; if ($newerVersion['status'] == 'lts') { - $vNum .= ' ' . ts('(long-term support)'); // LTS = long-term support version + $vNum .= ' ' . ts('(long-term support)'); // LTS = long-term support version } $severity = \Psr\Log\LogLevel::INFO; diff --git a/CRM/Utils/Check/Message.php b/CRM/Utils/Check/Message.php index a4db669e74..2bf5dec909 100644 --- a/CRM/Utils/Check/Message.php +++ b/CRM/Utils/Check/Message.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Check_Message { /** diff --git a/CRM/Utils/Check/Security.php b/CRM/Utils/Check/Security.php index d39be900b4..672d81aa0a 100644 --- a/CRM/Utils/Check/Security.php +++ b/CRM/Utils/Check/Security.php @@ -29,15 +29,13 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Check_Security { /** * CMS have a different pattern to their default file path and URL. * - * @TODO This function might be better shared in CRM_Utils_Check + * @todo This function might be better shared in CRM_Utils_Check * class, but that class doesn't yet exist. */ public function getFilePathMarker() { @@ -138,7 +136,7 @@ class CRM_Utils_Check_Security { * Array of messages * @see CRM-14091 * - * @TODO: Test with WordPress, Joomla. + * @todo Test with WordPress, Joomla. */ public function checkUploadsAreNotAccessible() { $messages = array(); @@ -185,7 +183,7 @@ class CRM_Utils_Check_Security { * Array of messages * @see CRM-14091 * - * @TODO: Test with WordPress, Joomla. + * @todo Test with WordPress, Joomla. */ public function checkDirectoriesAreNotBrowseable() { $messages = array(); @@ -233,15 +231,15 @@ class CRM_Utils_Check_Security { $messages = array(); $files = array( array( - "{$civicrm_root}/packages/dompdf/dompdf.php", // CRM-16005, upgraded from Civi <= 4.5.6 + "{$civicrm_root}/packages/dompdf/dompdf.php", // CRM-16005, upgraded from Civi <= 4.5.6 \Psr\Log\LogLevel::CRITICAL, ), array( - "{$civicrm_root}/packages/vendor/dompdf/dompdf/dompdf.php", // CRM-16005, Civi >= 4.5.7 + "{$civicrm_root}/packages/vendor/dompdf/dompdf/dompdf.php", // CRM-16005, Civi >= 4.5.7 \Psr\Log\LogLevel::CRITICAL, ), array( - "{$civicrm_root}/vendor/dompdf/dompdf/dompdf.php", // CRM-16005, Civi >= 4.6.0 + "{$civicrm_root}/vendor/dompdf/dompdf/dompdf.php", // CRM-16005, Civi >= 4.6.0 \Psr\Log\LogLevel::CRITICAL, ), array( diff --git a/CRM/Utils/Constant.php b/CRM/Utils/Constant.php index 024cef760a..e6857b6e75 100644 --- a/CRM/Utils/Constant.php +++ b/CRM/Utils/Constant.php @@ -25,6 +25,12 @@ +--------------------------------------------------------------------+ */ +/** + * + * @package CRM + * @copyright CiviCRM LLC (c) 2004-2015 + */ + /** * Class CRM_Utils_Constant */ diff --git a/CRM/Utils/Crypt.php b/CRM/Utils/Crypt.php index 3a11771ea9..634b0d4ca1 100644 --- a/CRM/Utils/Crypt.php +++ b/CRM/Utils/Crypt.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_Crypt { diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php index e018f9611b..5276f7c631 100644 --- a/CRM/Utils/Date.php +++ b/CRM/Utils/Date.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** @@ -49,7 +47,6 @@ class CRM_Utils_Date { * * @return string * formatted string for date - * */ public static function format($date, $separator = '', $invalidDate = 0) { if (is_numeric($date) && @@ -679,7 +676,7 @@ class CRM_Utils_Date { if ($params[$dateParam]) { $params[$dateParam] = "$year$month$day"; } - //if month is invalid return as error + // if month is invalid return as error if ($month !== '00' && $month <= 12) { return TRUE; } @@ -1292,7 +1289,7 @@ class CRM_Utils_Date { $subtractYear = 0; $quarter = ceil($now['mon'] / 3); $quarter = $quarter - $difference; - //CRM-14550 QA Fix + // CRM-14550 QA Fix if ($quarter > 4) { $now['year'] = $now['year'] + 1; $quarter = 1; @@ -1379,7 +1376,7 @@ class CRM_Utils_Date { break; case 'earlier': - //before end of past month + // before end of past month if ($now['mon'] == 1) { $to['M'] = 12; $to['Y'] = $now['year'] - 1; @@ -1401,7 +1398,7 @@ class CRM_Utils_Date { break; case 'greater_previous': - //from end of past month + // from end of past month if ($now['mon'] == 1) { $from['M'] = 12; $from['Y'] = $now['year'] - 1; @@ -1447,7 +1444,7 @@ class CRM_Utils_Date { break; case 'less': - //CRM-14550 QA Fix + // CRM-14550 QA Fix $to['Y'] = $now['year']; $to['M'] = $now['mon']; $to['d'] = date('t', mktime(0, 0, 0, $now['mon'], 1, $now['year'])); @@ -1581,7 +1578,7 @@ class CRM_Utils_Date { $to['d'] = $now['mday']; $to['M'] = $now['mon']; $to['Y'] = $now['year']; - //CRM-14550 QA Fix + // CRM-14550 QA Fix $to = self::intervalAdd('day', -1 * ($diffDay) + 6, $to); unset($from); break; @@ -1700,7 +1697,7 @@ class CRM_Utils_Date { $date = date("Y-m-d"); $currentYear = date("Y"); - //recalculate the date because month 4::04 make the difference + // recalculate the date because month 4::04 make the difference $fiscalYear = explode('-', date("Y-m-d", mktime(0, 0, 0, $fyMonth, $fyDate, $currentYear))); $fyDate = $fiscalYear[2]; $fyMonth = $fiscalYear[1]; @@ -1716,7 +1713,7 @@ class CRM_Utils_Date { } /** - * Function to process date, convert to mysql format + * Function to process date, convert to mysql format * * @param string $date * Date string. @@ -1745,7 +1742,7 @@ class CRM_Utils_Date { } /** - * Function to convert mysql to date plugin format. + * Function to convert mysql to date plugin format. * * @param string $mysqlDate * Date string. @@ -1870,10 +1867,10 @@ class CRM_Utils_Date { return $formattedDate; } - //1. first convert date to default format. - //2. append time to default formatted date (might be removed during format) - //3. validate date / date time. - //4. If date and time then convert to default date time format. + // 1. first convert date to default format. + // 2. append time to default formatted date (might be removed during format) + // 3. validate date / date time. + // 4. If date and time then convert to default date time format. $dateKey = 'date'; $dateParams = array($dateKey => $date); @@ -1895,10 +1892,10 @@ class CRM_Utils_Date { $valid = CRM_Utils_Rule::$ruleName($dateVal); if ($valid) { - //format date and time to default. + // format date and time to default. if ($ruleName == 'dateTime') { $dateVal = CRM_Utils_Date::customFormat(preg_replace("/(:|\s)?/", "", $dateVal), '%Y%m%d%H%i'); - //hack to add seconds + // hack to add seconds $dateVal .= '00'; } $formattedDate = $dateVal; diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index 73bc504b32..c1da326b60 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -25,6 +25,12 @@ +--------------------------------------------------------------------+ */ +/** + * + * @package CRM + * @copyright CiviCRM LLC (c) 2004-2015 + */ + /* * These functions have been deprecated out of API v3 Utils folder as they are not part of the * API. Calling API functions directly is not supported & these functions are not called by any @@ -62,7 +68,7 @@ function _civicrm_api3_deprecated_participant_formatted_param($params, &$values, continue; } - //Handling Custom Data + // Handling Custom Data if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) { $values[$key] = $value; $type = $customFields[$customFieldID]['html_type']; @@ -238,7 +244,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F continue; } - //Handling Custom Data + // Handling Custom Data if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) { $values[$key] = $value; $type = $customFields[$customFieldID]['html_type']; @@ -302,10 +308,10 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F break; case 'contact_type': - //import contribution record according to select contact type + // import contribution record according to select contact type require_once 'CRM/Contact/DAO/Contact.php'; $contactType = new CRM_Contact_DAO_Contact(); - //when insert mode check contact id or external identifier + // when insert mode check contact id or external identifier if (!empty($params['contribution_contact_id']) || !empty($params['external_identifier'])) { if (!empty($params['contribution_contact_id'])) { $contactType->id = CRM_Utils_Array::value('contribution_contact_id', $params); @@ -320,8 +326,8 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F } } elseif (!empty($params['contribution_id']) || !empty($params['trxn_id']) || !empty($params['invoice_id'])) { - //when update mode check contribution id or trxn id or - //invoice id + // when update mode check contribution id or trxn id or + // invoice id $contactId = new CRM_Contribute_DAO_Contribution(); if (!empty($params['contribution_id'])) { $contactId->id = $params['contribution_id']; @@ -405,7 +411,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F break; case 'soft_credit': - //import contribution record according to select contact type + // import contribution record according to select contact type // validate contact id and external identifier. $value[$key] = $mismatchContactType = $softCreditContactIds = ''; if (isset($params[$key]) && is_array($params[$key])) { @@ -464,20 +470,20 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F case 'pledge_payment': case 'pledge_id': - //giving respect to pledge_payment flag. + // giving respect to pledge_payment flag. if (empty($params['pledge_payment'])) { continue; } - //get total amount of from import fields + // get total amount of from import fields $totalAmount = CRM_Utils_Array::value('total_amount', $params); $onDuplicate = CRM_Utils_Array::value('onDuplicate', $params); - //we need to get contact id $contributionContactID to - //retrieve pledge details as well as to validate pledge ID + // we need to get contact id $contributionContactID to + // retrieve pledge details as well as to validate pledge ID - //first need to check for update mode + // first need to check for update mode if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE && ($params['contribution_id'] || $params['trxn_id'] || $params['invoice_id']) ) { @@ -519,7 +525,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F } } else { - // we need to get contribution contact using de dupe + // we need to get contribution contact using de dupe $error = _civicrm_api3_deprecated_check_contact_dedupe($params); if (isset($error['error_message']['params'][0])) { @@ -546,7 +552,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F $values['pledge_id'] = $params['pledge_id']; } else { - //check if there are any pledge related to this contact, with payments pending or in progress + // check if there are any pledge related to this contact, with payments pending or in progress require_once 'CRM/Pledge/BAO/Pledge.php'; $pledgeDetails = CRM_Pledge_BAO_Pledge::getContactPledges($contributionContactID); @@ -561,7 +567,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F $values['pledge_id'] = $pledgeDetails[0]; } - //we need to check if oldest payment amount equal to contribution amount + // we need to check if oldest payment amount equal to contribution amount require_once 'CRM/Pledge/BAO/PledgePayment.php'; $pledgePaymentDetails = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($values['pledge_id']); @@ -614,7 +620,7 @@ function _civicrm_api3_deprecated_check_contact_dedupe($params) { require_once "CRM/Core/BAO/LocationType.php"; $defaultLocation = CRM_Core_BAO_LocationType::getDefault(); - //set the value to default location id else set to 1 + // set the value to default location id else set to 1 if (!$defaultLocationId = (int) $defaultLocation->id) { $defaultLocationId = 1; } @@ -763,34 +769,33 @@ function _civicrm_api3_deprecated_activity_formatted_param(&$params, &$values, $ * @return bool|CRM_Utils_Error */ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { - /* Crawl through the possible classes: - * Contact - * Individual - * Household - * Organization - * Location - * Address - * Email - * Phone - * IM - * Note - * Custom - */ - - /* Cache the various object fields */ + // Crawl through the possible classes: + // Contact + // Individual + // Household + // Organization + // Location + // Address + // Email + // Phone + // IM + // Note + // Custom + + // Cache the various object fields static $fields = NULL; if ($fields == NULL) { $fields = array(); } - //first add core contact values since for other Civi modules they are not added + // first add core contact values since for other Civi modules they are not added require_once 'CRM/Contact/BAO/Contact.php'; $contactFields = CRM_Contact_DAO_Contact::fields(); _civicrm_api3_store_values($contactFields, $values, $params); if (isset($values['contact_type'])) { - /* we're an individual/household/org property */ + // we're an individual/household/org property $fields[$values['contact_type']] = CRM_Contact_DAO_Contact::fields(); @@ -820,7 +825,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { return TRUE; } - //CRM-4575 + // CRM-4575 if (isset($values['email_greeting'])) { if (!empty($params['email_greeting_id'])) { $emailGreetingFilter = array( @@ -894,7 +899,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { return TRUE; } - //format the website params. + // format the website params. if (!empty($values['url'])) { static $websiteFields; if (!is_array($websiteFields)) { @@ -922,7 +927,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { } if (isset($values['note'])) { - /* add a note field */ + // add a note field if (!isset($params['note'])) { $params['note'] = array(); } @@ -946,7 +951,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { return TRUE; } - /* Check for custom field values */ + // Check for custom field values if (empty($fields['custom'])) { $fields['custom'] = &CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $values), @@ -956,7 +961,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { foreach ($values as $key => $value) { if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) { - /* check if it's a valid custom field id */ + // check if it's a valid custom field id if (!array_key_exists($customFieldID, $fields['custom'])) { return civicrm_api3_create_error('Invalid custom field ID'); @@ -1180,7 +1185,7 @@ function _civicrm_api3_deprecated_duplicate_formatted_contact($params) { * @return bool|CRM_Core_Error */ function _civicrm_api3_deprecated_validate_formatted_contact(&$params) { - /* Look for offending email addresses */ + // Look for offending email addresses if (array_key_exists('email', $params)) { foreach ($params['email'] as $count => $values) { @@ -1188,12 +1193,12 @@ function _civicrm_api3_deprecated_validate_formatted_contact(&$params) { continue; } if ($email = CRM_Utils_Array::value('email', $values)) { - //validate each email + // validate each email if (!CRM_Utils_Rule::email($email)) { return civicrm_api3_create_error('No valid email address'); } - //check for loc type id. + // check for loc type id. if (empty($values['location_type_id'])) { return civicrm_api3_create_error('Location Type Id missing.'); } @@ -1201,7 +1206,7 @@ function _civicrm_api3_deprecated_validate_formatted_contact(&$params) { } } - /* Validate custom data fields */ + // Validate custom data fields if (array_key_exists('custom', $params) && is_array($params['custom'])) { foreach ($params['custom'] as $key => $custom) { if (is_array($custom)) { @@ -1259,7 +1264,7 @@ function _civicrm_api3_deprecated_create_participant_formatted($params, $onDupli */ function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplicate = FALSE) { - //check if participant id is valid or not + // check if participant id is valid or not if (!empty($params['id'])) { $participant = new CRM_Event_BAO_Participant(); $participant->id = $params['id']; @@ -1268,7 +1273,7 @@ function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplic } } require_once 'CRM/Contact/BAO/Contact.php'; - //check if contact id is valid or not + // check if contact id is valid or not if (!empty($params['contact_id'])) { $contact = new CRM_Contact_BAO_Contact(); $contact->id = $params['contact_id']; @@ -1277,7 +1282,7 @@ function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplic } } - //check that event id is not an template + // check that event id is not an template if (!empty($params['event_id'])) { $isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'is_template'); if (!empty($isTemplate)) { @@ -1334,7 +1339,7 @@ function _civicrm_api3_deprecated_contact_check_custom_params($params, $csType = foreach ($params as $key => $value) { if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) { - /* check if it's a valid custom field id */ + // check if it's a valid custom field id if (!array_key_exists($customFieldID, $customFields)) { $errorMsg = "Invalid Custom Field Contact Type: {$params['contact_type']}"; @@ -1459,7 +1464,7 @@ function _civicrm_api3_deprecated_contact_check_params( } } - //check for organisations with same name + // check for organisations with same name if (!empty($params['current_employer'])) { $organizationParams = array(); $organizationParams['organization_name'] = $params['current_employer']; @@ -1487,7 +1492,6 @@ function _civicrm_api3_deprecated_contact_check_params( } /** - * * @param $result * @param int $activityTypeID * diff --git a/CRM/Utils/FakeObject.php b/CRM/Utils/FakeObject.php index 7052d6867c..aa30cb70da 100644 --- a/CRM/Utils/FakeObject.php +++ b/CRM/Utils/FakeObject.php @@ -1,4 +1,35 @@ dsn . $config->userFrameworkResourceURL); - //$fileName = "{$config->configAndLogDir}" . $prefix . $nonce . $suffix; + // $config = CRM_Core_Config::singleton(); + // $nonce = md5(uniqid() . $config->dsn . $config->userFrameworkResourceURL); + // $fileName = "{$config->configAndLogDir}" . $prefix . $nonce . $suffix; $fileName = tempnam(sys_get_temp_dir(), $prefix); return $fileName; } @@ -634,7 +630,7 @@ HTACCESS; /** * Create a path to a temporary directory which can endure for multiple requests. * - * TODO: Automatic file cleanup using, eg, TTL policy + * @todo Automatic file cleanup using, eg, TTL policy * * @param string $prefix * @@ -741,7 +737,7 @@ HTACCESS; } } - // return rename($fromDir, $toDir); // CRM-11987, https://bugs.php.net/bug.php?id=54097 + // return rename($fromDir, $toDir); CRM-11987, https://bugs.php.net/bug.php?id=54097 CRM_Utils_File::copyDir($fromDir, $toDir); if (!CRM_Utils_File::cleanDir($fromDir, TRUE, FALSE)) { diff --git a/CRM/Utils/Geocode.php b/CRM/Utils/Geocode.php index cf26e222ec..38472994d6 100644 --- a/CRM/Utils/Geocode.php +++ b/CRM/Utils/Geocode.php @@ -25,6 +25,12 @@ +--------------------------------------------------------------------+ */ +/** + * + * @package CRM + * @copyright CiviCRM LLC (c) 2004-2015 + */ + /** * Class CRM_Utils_Geocode */ diff --git a/CRM/Utils/Geocode/Google.php b/CRM/Utils/Geocode/Google.php index 3538b70e34..21335710b9 100644 --- a/CRM/Utils/Geocode/Google.php +++ b/CRM/Utils/Geocode/Google.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** diff --git a/CRM/Utils/Geocode/Yahoo.php b/CRM/Utils/Geocode/Yahoo.php index 9cc66af376..1010c40bb0 100644 --- a/CRM/Utils/Geocode/Yahoo.php +++ b/CRM/Utils/Geocode/Yahoo.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** diff --git a/CRM/Utils/GlobalStack.php b/CRM/Utils/GlobalStack.php index 3e8aa921b0..e718b5a43c 100644 --- a/CRM/Utils/GlobalStack.php +++ b/CRM/Utils/GlobalStack.php @@ -24,6 +24,12 @@ +--------------------------------------------------------------------+ */ +/** + * + * @package CRM + * @copyright CiviCRM LLC (c) 2004-2015 + */ + /** * Temporarily change a global variable. * diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php index 2b38e59cba..950ec296e9 100644 --- a/CRM/Utils/Hook.php +++ b/CRM/Utils/Hook.php @@ -42,9 +42,9 @@ abstract class CRM_Utils_Hook { // by default - place content below existing content const SUMMARY_BELOW = 1; - // pace hook content above + // place hook content above const SUMMARY_ABOVE = 2; - // create your own summarys + // create your own summaries const SUMMARY_REPLACE = 3; static $_nullObject = NULL; @@ -1266,7 +1266,7 @@ abstract class CRM_Utils_Hook { * the selector object. Allows you access to the context of the search * * @return mixed - * modify the header and values object to pass the data u need + * modify the header and values object to pass the data you need */ public static function searchColumns($objectName, &$headers, &$rows, &$selector) { return self::singleton()->invoke(4, $objectName, $headers, $rows, $selector, @@ -1627,9 +1627,9 @@ abstract class CRM_Utils_Hook { self::singleton() ->invoke(2, $exception, $request, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_unhandled_exception'); // == 4.4 == - //$event = new stdClass(); - //$event->exception = $exception; - //CRM_Core_LegacyErrorHandler::handleException($event); + // $event = new stdClass(); + // $event->exception = $exception; + // CRM_Core_LegacyErrorHandler::handleException($event); // == 4.5+ == $event = new \Civi\Core\Event\UnhandledExceptionEvent($exception, self::$_nullObject); diff --git a/CRM/Utils/Hook/Drupal.php b/CRM/Utils/Hook/Drupal.php index be6c89dd4d..4e2e01f390 100644 --- a/CRM/Utils/Hook/Drupal.php +++ b/CRM/Utils/Hook/Drupal.php @@ -29,8 +29,6 @@ * * @package CiviCRM_Hook * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Hook_Drupal extends CRM_Utils_Hook_DrupalBase { diff --git a/CRM/Utils/Hook/Drupal6.php b/CRM/Utils/Hook/Drupal6.php index 70e92aeae6..13b573baca 100644 --- a/CRM/Utils/Hook/Drupal6.php +++ b/CRM/Utils/Hook/Drupal6.php @@ -29,8 +29,6 @@ * * @package CiviCRM_Hook * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Hook_Drupal6 extends CRM_Utils_Hook_DrupalBase { } diff --git a/CRM/Utils/Hook/Drupal8.php b/CRM/Utils/Hook/Drupal8.php index bb9f3a5d95..ca6e8b397c 100644 --- a/CRM/Utils/Hook/Drupal8.php +++ b/CRM/Utils/Hook/Drupal8.php @@ -29,8 +29,6 @@ * * @package CiviCRM_Hook * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Hook_Drupal8 extends CRM_Utils_Hook_DrupalBase { diff --git a/CRM/Utils/Hook/DrupalBase.php b/CRM/Utils/Hook/DrupalBase.php index 077510fbfb..be681e5758 100644 --- a/CRM/Utils/Hook/DrupalBase.php +++ b/CRM/Utils/Hook/DrupalBase.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_Hook_DrupalBase extends CRM_Utils_Hook { diff --git a/CRM/Utils/Hook/Joomla.php b/CRM/Utils/Hook/Joomla.php index 8ac59504ea..026715fcda 100644 --- a/CRM/Utils/Hook/Joomla.php +++ b/CRM/Utils/Hook/Joomla.php @@ -29,8 +29,6 @@ * * @package CiviCRM_Hook * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Hook_Joomla extends CRM_Utils_Hook { /** diff --git a/CRM/Utils/Hook/Soap.php b/CRM/Utils/Hook/Soap.php index acdc28a25f..124e27be64 100644 --- a/CRM/Utils/Hook/Soap.php +++ b/CRM/Utils/Hook/Soap.php @@ -29,8 +29,6 @@ * * @package CiviCRM_Hook * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Hook_Soap extends CRM_Utils_Hook { /** diff --git a/CRM/Utils/Hook/UnitTests.php b/CRM/Utils/Hook/UnitTests.php index 9812d2cfab..60a03581eb 100644 --- a/CRM/Utils/Hook/UnitTests.php +++ b/CRM/Utils/Hook/UnitTests.php @@ -29,15 +29,13 @@ * * @package CiviCRM_Hook * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook { protected $mockObject; /** - * @var array adhocHooks to call + * @var array $adhocHooks to call */ protected $adhocHooks; protected $civiModules = NULL; diff --git a/CRM/Utils/Hook/WordPress.php b/CRM/Utils/Hook/WordPress.php index d2467b5241..765830560f 100644 --- a/CRM/Utils/Hook/WordPress.php +++ b/CRM/Utils/Hook/WordPress.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_Hook_WordPress extends CRM_Utils_Hook { @@ -91,22 +89,20 @@ class CRM_Utils_Hook_WordPress extends CRM_Utils_Hook { $fnSuffix ) { - /** - * do_action_ref_array is the default way of calling WordPress hooks - * because for the most part no return value is wanted. However, this is - * only generally true, so using do_action_ref_array() is only called for those - * hooks which do not require a return value. We exclude the following, which - * are incompatible with the WordPress Plugin API: - * - * civicrm_upgrade - * http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_upgrade - * - * civicrm_caseSummary - * http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_caseSummary - * - * civicrm_dashboard - * http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_dashboard - */ + // do_action_ref_array is the default way of calling WordPress hooks + // because for the most part no return value is wanted. However, this is + // only generally true, so using do_action_ref_array() is only called for those + // hooks which do not require a return value. We exclude the following, which + // are incompatible with the WordPress Plugin API: + // + // civicrm_upgrade + // http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_upgrade + // + // civicrm_caseSummary + // http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_caseSummary + // + // civicrm_dashboard + // http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_dashboard // distinguish between types of hook if (!in_array($fnSuffix, $this->hooksThatReturn)) { @@ -118,12 +114,10 @@ class CRM_Utils_Hook_WordPress extends CRM_Utils_Hook { $numParams ); - /** - * Use WordPress Plugins API to modify $args - * - * Because $args are passed as references to the WordPress callbacks, - * runHooks subsequently receives appropriately modified parameters. - */ + // Use WordPress Plugins API to modify $args + // + // Because $args are passed as references to the WordPress callbacks, + // runHooks subsequently receives appropriately modified parameters. // protect from REST calls if (function_exists('do_action_ref_array')) { @@ -132,25 +126,23 @@ class CRM_Utils_Hook_WordPress extends CRM_Utils_Hook { } - /** - * The following is based on the logic of the Joomla hook file by allowing - * WordPress callbacks to do their stuff before runHooks gets called. - * - * It also follows the logic of the Drupal hook file by building the "module" - * (read "plugin") list and then calling runHooks directly. This should avoid - * the need for the post-processing that the Joomla hook file does. - * - * Note that hooks which require a return value are incompatible with the - * signature of apply_filters_ref_array and must therefore be called in - * global scope, like in Drupal. It's not ideal, but plugins can always route - * these calls to methods in their classes. - * - * At some point, those hooks could be pre-processed and called via the WordPress - * Plugin API, but it would change their signature and require the CiviCRM docs - * to be rewritten for those calls in WordPress. So it's been done this way for - * now. Ideally these hooks will be deprecated in favour of hooks that do not - * require return values. - */ + // The following is based on the logic of the Joomla hook file by allowing + // WordPress callbacks to do their stuff before runHooks gets called. + + // It also follows the logic of the Drupal hook file by building the "module" + // (read "plugin") list and then calling runHooks directly. This should avoid + // the need for the post-processing that the Joomla hook file does. + + // Note that hooks which require a return value are incompatible with the + // signature of apply_filters_ref_array and must therefore be called in + // global scope, like in Drupal. It's not ideal, but plugins can always route + // these calls to methods in their classes. + + // At some point, those hooks could be pre-processed and called via the WordPress + // Plugin API, but it would change their signature and require the CiviCRM docs + // to be rewritten for those calls in WordPress. So it's been done this way for + // now. Ideally these hooks will be deprecated in favour of hooks that do not + // require return values. // build list of registered plugin codes $this->buildModuleList(); @@ -192,11 +184,9 @@ class CRM_Utils_Hook_WordPress extends CRM_Utils_Hook { // initialise with the pre-existing 'wordpress' prefix $this->wordpressModules = array('wordpress'); - /** - * Use WordPress Plugin API to build list - * a plugin simply needs to declare its "unique_plugin_code" thus: - * add_filter('civicrm_wp_plugin_codes', 'function_that_returns_my_unique_plugin_code'); - */ + // Use WordPress Plugin API to build list + // a plugin simply needs to declare its "unique_plugin_code" thus: + // add_filter('civicrm_wp_plugin_codes', 'function_that_returns_my_unique_plugin_code'); // protect from REST calls if (function_exists('apply_filters')) { diff --git a/CRM/Utils/Http.php b/CRM/Utils/Http.php index 688ef8c175..ec16188112 100644 --- a/CRM/Utils/Http.php +++ b/CRM/Utils/Http.php @@ -1,5 +1,35 @@ createCurl($remoteFile); if (preg_match('/^https:/', $remoteFile) && !$caConfig->isEnableSSL()) { - //CRM_Core_Error::fatal('Cannot install this extension - does not support SSL'); + // CRM_Core_Error::fatal('Cannot install this extension - does not support SSL'); return array(self::STATUS_DL_ERROR, NULL); } @@ -171,7 +170,7 @@ class CRM_Utils_HttpClient { list($ch, $caConfig) = $this->createCurl($remoteFile); if (preg_match('/^https:/', $remoteFile) && !$caConfig->isEnableSSL()) { - //CRM_Core_Error::fatal('Cannot install this extension - does not support SSL'); + // CRM_Core_Error::fatal('Cannot install this extension - does not support SSL'); return array(self::STATUS_DL_ERROR, NULL); } diff --git a/CRM/Utils/JS.php b/CRM/Utils/JS.php index 4773b3a948..4fd8d76e61 100644 --- a/CRM/Utils/JS.php +++ b/CRM/Utils/JS.php @@ -30,8 +30,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_JS { /** diff --git a/CRM/Utils/JSON.php b/CRM/Utils/JSON.php index 5c9e73f87d..eb3b5d5230 100644 --- a/CRM/Utils/JSON.php +++ b/CRM/Utils/JSON.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** @@ -77,12 +75,12 @@ class CRM_Utils_JSON { if ($addcomma) { $sOutput .= ","; } - //CRM-7130 --lets addslashes to only double quotes, - //since we are using it to quote the field value. - //str_replace helps to provide a break for new-line + // CRM-7130 --lets addslashes to only double quotes, + // since we are using it to quote the field value. + // str_replace helps to provide a break for new-line $sOutput .= '"' . addcslashes(str_replace(array("\r\n", "\n", "\r"), '
    ', $value[$element]), '"\\') . '"'; - //remove extra spaces and tab character that breaks dataTable CRM-12551 + // remove extra spaces and tab character that breaks dataTable CRM-12551 $sOutput = preg_replace("/\s+/", " ", $sOutput); $addcomma = TRUE; } diff --git a/CRM/Utils/Mail.php b/CRM/Utils/Mail.php index 7986f84eac..b7ea6dff01 100644 --- a/CRM/Utils/Mail.php +++ b/CRM/Utils/Mail.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_Mail { @@ -218,7 +216,7 @@ class CRM_Utils_Mail { $headers['Auto-Submitted'] = "Auto-Generated"; } - //make sure we has to have space, CRM-6977 + // make sure we has to have space, CRM-6977 foreach (array('From', 'To', 'Cc', 'Bcc', 'Reply-To', 'Return-Path') as $fld) { if (isset($headers[$fld])) { $headers[$fld] = str_replace('"<', '" <', $headers[$fld]); @@ -265,8 +263,8 @@ class CRM_Utils_Mail { // Mail_smtp and Mail_sendmail mailers require Bcc anc Cc emails // be included in both $to and $headers['Cc', 'Bcc'] if (get_class($mailer) != "Mail_mail") { - //get emails from headers, since these are - //combination of name and email addresses. + // get emails from headers, since these are + // combination of name and email addresses. if (!empty($headers['Cc'])) { $to[] = CRM_Utils_Array::value('Cc', $headers); } @@ -471,6 +469,10 @@ class CRM_Utils_Mail { * and if so does the needful and return the formatted name * * This code has been copied and adapted from ezc/Mail/src/tools.php + * + * @param string $name + * + * @return string */ public static function formatRFC2822Name($name) { $name = trim($name); @@ -499,10 +501,10 @@ class CRM_Utils_Mail { public static function appendPDF($fileName, $html, $format = NULL) { $pdf_filename = CRM_Core_Config::singleton()->templateCompileDir . CRM_Utils_File::makeFileName($fileName); - //FIXME : CRM-7894 - //xmlns attribute is required in XHTML but it is invalid in HTML, - //Also the namespace "xmlns=http://www.w3.org/1999/xhtml" is default, - //and will be added to the tag even if you do not include it. + // FIXME : CRM-7894 + // xmlns attribute is required in XHTML but it is invalid in HTML, + // Also the namespace "xmlns=http://www.w3.org/1999/xhtml" is default, + // and will be added to the tag even if you do not include it. $html = preg_replace('/()/', '\1\3\4', $html); file_put_contents($pdf_filename, CRM_Utils_PDF_Utils::html2pdf($html, diff --git a/CRM/Utils/Mail/Incoming.php b/CRM/Utils/Mail/Incoming.php index ce1ff6878c..5b3ddb8219 100644 --- a/CRM/Utils/Mail/Incoming.php +++ b/CRM/Utils/Mail/Incoming.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_Mail_Incoming { const diff --git a/CRM/Utils/Migrate/Export.php b/CRM/Utils/Migrate/Export.php index f0e584cb9c..38d9edb0b3 100644 --- a/CRM/Utils/Migrate/Export.php +++ b/CRM/Utils/Migrate/Export.php @@ -50,8 +50,6 @@ class CRM_Utils_Migrate_Export { */ protected $_xml; - /** - */ public function __construct() { $this->_xml = array( 'customGroup' => array( diff --git a/CRM/Utils/Migrate/ExportJSON.php b/CRM/Utils/Migrate/ExportJSON.php index 3b575a7a94..e205cd1a57 100644 --- a/CRM/Utils/Migrate/ExportJSON.php +++ b/CRM/Utils/Migrate/ExportJSON.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_Migrate_ExportJSON { const CHUNK_SIZE = 128; @@ -299,8 +297,10 @@ SELECT * } /** - * TODO - support group inheritance + * @todo support group inheritance + * * Parent child group ids are encoded in a text string + * * @param $contactIDs */ public function group(&$contactIDs) { @@ -330,7 +330,7 @@ WHERE contact_id IN ( $ids ) } /** - * TODO - support search builder and custom saved searches + * @todo support search builder and custom saved searches * @param $groupIDs */ public function savedSearch(&$groupIDs) { diff --git a/CRM/Utils/Migrate/Import.php b/CRM/Utils/Migrate/Import.php index 9f09ccd938..b4fe967d97 100644 --- a/CRM/Utils/Migrate/Import.php +++ b/CRM/Utils/Migrate/Import.php @@ -83,7 +83,7 @@ class CRM_Utils_Migrate_Import { $this->profileFields($xml, $idMap); $this->profileJoins($xml, $idMap); - //create DB Template String sample data + // create DB Template String sample data $this->dbTemplateString($xml, $idMap); // clean up all caches etc diff --git a/CRM/Utils/Migrate/ImportJSON.php b/CRM/Utils/Migrate/ImportJSON.php index a32db531cb..33ac324a22 100644 --- a/CRM/Utils/Migrate/ImportJSON.php +++ b/CRM/Utils/Migrate/ImportJSON.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_Migrate_ImportJSON { @@ -38,8 +36,6 @@ class CRM_Utils_Migrate_ImportJSON { protected $_saveMapping; - /** - */ public function __construct() { $this->_lookupCache = array(); $this->_saveMapping = array(); @@ -53,7 +49,7 @@ class CRM_Utils_Migrate_ImportJSON { $decodedContacts = json_decode($json); - //migrate contact data + // migrate contact data $this->contact($decodedContacts->civicrm_contact); $this->email($decodedContacts->civicrm_email); $this->phone($decodedContacts->civicrm_phone); diff --git a/CRM/Utils/Money.php b/CRM/Utils/Money.php index 2a7bc976df..6064602454 100644 --- a/CRM/Utils/Money.php +++ b/CRM/Utils/Money.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** diff --git a/CRM/Utils/Network.php b/CRM/Utils/Network.php index ffd686c69e..a2c7b0f7ea 100644 --- a/CRM/Utils/Network.php +++ b/CRM/Utils/Network.php @@ -26,11 +26,8 @@ */ /** - * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ /** diff --git a/CRM/Utils/Number.php b/CRM/Utils/Number.php index f3e427acd2..d1858b3857 100644 --- a/CRM/Utils/Number.php +++ b/CRM/Utils/Number.php @@ -1,4 +1,34 @@ 123456 - $val = substr($val, 0, $sigFigs); // ex: 123456 => 1234 + $val = substr($val, 0, $sigFigs); // ex: 123456 => 1234 // Move any extra digits after decimal $extraFigs = strlen($val) - ($sigFigs - $decFigs); @@ -69,7 +100,7 @@ class CRM_Utils_Number { if ($maxImportFileSize > $postMaxSize && $postMaxSize == $size) { CRM_Core_Session::setStatus(ts("Note: Upload max filesize ('upload_max_filesize') should not exceed Post max size ('post_max_size') as defined in PHP.ini, please check with your system administrator."), ts("Warning"), "alert"); } - //respect php.ini upload_max_filesize + // respect php.ini upload_max_filesize if ($size > $maxImportFileSize && $size !== $postMaxSize) { $size = $maxImportFileSize; CRM_Core_Session::setStatus(ts("Note: Please verify your configuration for Maximum File Size (in MB) Administrator >> System Settings >> Misc. It should support 'upload_max_size' as defined in PHP.ini.Please check with your system administrator.", array(1 => CRM_Utils_System::url('civicrm/admin/setting/misc', 'reset=1'))), ts("Warning"), "alert"); diff --git a/CRM/Utils/OpenFlashChart.php b/CRM/Utils/OpenFlashChart.php index 6e24238321..1349902b4b 100644 --- a/CRM/Utils/OpenFlashChart.php +++ b/CRM/Utils/OpenFlashChart.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ require_once 'packages/OpenFlashChart/php-ofc-library/open-flash-chart.php'; @@ -89,7 +87,7 @@ class CRM_Utils_OpenFlashChart { $xValues = array_keys($values[0]); $yValues = array_values($values[0]); - //set y axis parameters. + // set y axis parameters. $yMin = 0; // calculate max scale for graph. @@ -148,7 +146,7 @@ class CRM_Utils_OpenFlashChart { $xAxis = new x_axis(); $xAxis->set_labels($xLabels); - //create y axis and set range. + // create y axis and set range. $yAxis = new y_axis(); $yAxis->set_range($yMin, $yMax, $ySteps); @@ -215,7 +213,7 @@ class CRM_Utils_OpenFlashChart { } $graphTitle = !empty($params['legend']) ? $params['legend'] : ts('Pie Chart'); - //get the currency. + // get the currency. $config = CRM_Core_Config::singleton(); $symbol = $config->defaultCurrencySymbol; @@ -240,7 +238,7 @@ class CRM_Utils_OpenFlashChart { $pie->set_values($values); - //create chart. + // create chart. $chart = new open_flash_chart(); // create chart title obj. @@ -328,7 +326,7 @@ class CRM_Utils_OpenFlashChart { $chartTitle = !empty($params['legend']) ? $params['legend'] : ts('Bar Chart'); - //set y axis parameters. + // set y axis parameters. $yMin = 0; // calculate max scale for graph. @@ -359,7 +357,7 @@ class CRM_Utils_OpenFlashChart { $xAxis = new x_axis(); $xAxis->set_labels($xLabels); - //create y axis and set range. + // create y axis and set range. $yAxis = new y_axis(); $yAxis->set_range($yMin, $yMax, $ySteps); @@ -466,7 +464,7 @@ class CRM_Utils_OpenFlashChart { $chartData['tip'] = $rows['tip']; } - //legend + // legend $chartData['xname'] = CRM_Utils_Array::value('xname', $rows); $chartData['yname'] = CRM_Utils_Array::value('yname', $rows); @@ -544,7 +542,7 @@ class CRM_Utils_OpenFlashChart { if ($chart == 'barChart') { $ySize = CRM_Utils_Array::value('ySize', $params, 250); $xSize = 60 * count($params['values']); - //hack to show tooltip. + // hack to show tooltip. if ($xSize < 200) { $xSize = (count($params['values']) > 1) ? 100 * count($params['values']) : 170; } diff --git a/CRM/Utils/OptionBag.php b/CRM/Utils/OptionBag.php index 4149cd272a..5c296520da 100644 --- a/CRM/Utils/OptionBag.php +++ b/CRM/Utils/OptionBag.php @@ -1,4 +1,35 @@ + * (PHP 5 >= 5.0.0) * Whether a offset exists * @link http://php.net/manual/en/arrayaccess.offsetexists.php + * * @param mixed $offset - *

    . - * An offset to check for. - *

    + * An offset to check for. + * * @return bool * true on success or false on failure. - *

    - *

    * The return value will be casted to boolean if non-boolean was returned. */ public function offsetExists($offset) { @@ -73,13 +102,13 @@ class CRM_Utils_OptionBag implements ArrayAccess, IteratorAggregate, Countable { } /** - * (PHP 5 >= 5.0.0)
    + * (PHP 5 >= 5.0.0) * Offset to retrieve * @link http://php.net/manual/en/arrayaccess.offsetget.php + * * @param mixed $offset - *

    . - * The offset to retrieve. - *

    + * The offset to retrieve. + * * @return mixed * Can return all value types. */ @@ -88,55 +117,52 @@ class CRM_Utils_OptionBag implements ArrayAccess, IteratorAggregate, Countable { } /** - * (PHP 5 >= 5.0.0)
    + * (PHP 5 >= 5.0.0) * Offset to set * @link http://php.net/manual/en/arrayaccess.offsetset.php + * * @param mixed $offset - *

    . - * The offset to assign the value to. - *

    + * The offset to assign the value to. + * * @param mixed $value - *

    . - * The value to set. - *

    + * The value to set. */ public function offsetSet($offset, $value) { $this->data[$offset] = $value; } /** - * (PHP 5 >= 5.0.0)
    + * (PHP 5 >= 5.0.0) * Offset to unset * @link http://php.net/manual/en/arrayaccess.offsetunset.php + * * @param mixed $offset - *

    . - * The offset to unset. - *

    + * The offset to unset. */ public function offsetUnset($offset) { unset($this->data[$offset]); } /** - * (PHP 5 >= 5.0.0)
    + * (PHP 5 >= 5.0.0) * Retrieve an external iterator * @link http://php.net/manual/en/iteratoraggregate.getiterator.php + * * @return Traversable - * An instance of an object implementing Iterator or - * Traversable + * An instance of an object implementing Iterator or + * Traversable */ public function getIterator() { return new ArrayIterator($this->data); } /** - * (PHP 5 >= 5.1.0)
    + * (PHP 5 >= 5.1.0) * Count elements of an object * @link http://php.net/manual/en/countable.count.php + * * @return int * The custom count as an integer. - *

    - *

    * The return value is cast to an integer. */ public function count() { diff --git a/CRM/Utils/PDF/Label.php b/CRM/Utils/PDF/Label.php index 5deab7b703..4dd4ffff00 100644 --- a/CRM/Utils/PDF/Label.php +++ b/CRM/Utils/PDF/Label.php @@ -26,12 +26,11 @@ */ /** - * Class to print labels in Avery or custom formats + * Class to print labels in Avery or custom formats * functionality and smarts to the base PDF_Label. * + * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * - * */ require_once 'tcpdf/tcpdf.php'; diff --git a/CRM/Utils/PDF/Utils.php b/CRM/Utils/PDF/Utils.php index 7507a664f6..9f103d72a8 100644 --- a/CRM/Utils/PDF/Utils.php +++ b/CRM/Utils/PDF/Utils.php @@ -33,8 +33,6 @@ define('DOMPDF_ENABLE_AUTOLOAD', FALSE); * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_PDF_Utils { diff --git a/CRM/Utils/Pager.php b/CRM/Utils/Pager.php index 9f8d87e867..222222f675 100644 --- a/CRM/Utils/Pager.php +++ b/CRM/Utils/Pager.php @@ -26,13 +26,11 @@ */ /** - * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 */ /** - * * This class extends the PEAR pager object by substituting standard default pager arguments * We also extract the pageId from either the GET variables or the POST variable (since we * use a POST to jump to a specific page). At some point we should evaluate if we want @@ -55,6 +53,7 @@ class CRM_Utils_Pager extends Pager_Sliding { /** * The output of the pager. This is a name/value array with various keys * that an application could use to display the pager + * * @var array */ public $_response; @@ -110,8 +109,7 @@ class CRM_Utils_Pager extends Pager_Sliding { /** * A page cannot have two variables with the same form name. Hence in the * pager display, we have a form submission at the top with the normal - * page variable, but a different form element for one at the bottom - * + * page variable, but a different form element for one at the bottom. */ $this->_response['titleTop'] = ts('Page %1 of %2', array( 1 => '', @@ -133,15 +131,15 @@ class CRM_Utils_Pager extends Pager_Sliding { * @return array */ public function initialize(&$params) { - /* set the mode for the pager to Sliding */ + // set the mode for the pager to Sliding $params['mode'] = 'Sliding'; - /* also set the urlVar to be a crm specific get variable */ + // also set the urlVar to be a crm specific get variable. $params['urlVar'] = self::PAGE_ID; - /* set this to a small value, since we dont use this functionality */ + // set this to a small value, since we dont use this functionality $params['delta'] = 1; diff --git a/CRM/Utils/PagerAToZ.php b/CRM/Utils/PagerAToZ.php index 22ba273bd7..ca73afc944 100644 --- a/CRM/Utils/PagerAToZ.php +++ b/CRM/Utils/PagerAToZ.php @@ -26,16 +26,12 @@ */ /** - * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** * This class is for displaying alphabetical bar - * */ class CRM_Utils_PagerAToZ { @@ -61,7 +57,7 @@ class CRM_Utils_PagerAToZ { * Return the all the static characters. * * @return array - * is a array of static characters + * is an array of static characters */ public static function getStaticCharacters() { $staticAlphabets = array( @@ -102,7 +98,7 @@ class CRM_Utils_PagerAToZ { * @param $isDAO * * @return array - * is a array of dynamic characters + * is an array of dynamic characters */ public static function getDynamicCharacters(&$query, $isDAO) { if ($isDAO) { @@ -147,7 +143,7 @@ class CRM_Utils_PagerAToZ { sort($AToZBar, SORT_STRING); $AToZBar = array_unique($AToZBar); - //get the current path + // get the current path $path = CRM_Utils_System::currentPath(); $qfKey = NULL; diff --git a/CRM/Utils/PseudoConstant.php b/CRM/Utils/PseudoConstant.php index be85fe6bde..9624239608 100644 --- a/CRM/Utils/PseudoConstant.php +++ b/CRM/Utils/PseudoConstant.php @@ -25,6 +25,11 @@ +--------------------------------------------------------------------+ */ +/** + * @package CRM + * @copyright CiviCRM LLC (c) 2004-2015 + */ + /** * Utilities for manipulating/inspecting CRM_*_PseudoConstant classes. */ @@ -40,7 +45,8 @@ class CRM_Utils_PseudoConstant { ); /** - * @var array ($name => $className) + * @var array + * ($name => $className) */ private static $constants = NULL; diff --git a/CRM/Utils/QueryFormatter.php b/CRM/Utils/QueryFormatter.php index d5ea4f7a04..e4d8af9e9f 100644 --- a/CRM/Utils/QueryFormatter.php +++ b/CRM/Utils/QueryFormatter.php @@ -25,6 +25,11 @@ +--------------------------------------------------------------------+ */ + /** + * @package CRM + * @copyright CiviCRM LLC (c) 2004-2015 + */ + /** * Class CRM_Utils_QueryFormatter * @@ -83,7 +88,8 @@ class CRM_Utils_QueryFormatter { } /** - * @var string eg MODE_NONE + * @var string + * eg MODE_NONE */ protected $mode; diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index b57714af65..bb82f5c440 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -30,7 +30,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * */ class CRM_Utils_REST { @@ -68,7 +67,7 @@ class CRM_Utils_REST { public static function ping($var = NULL) { $session = CRM_Core_Session::singleton(); $key = $session->get('key'); - //$session->set( 'key', $var ); + // $session->set( 'key', $var ); return self::simple(array('message' => "PONG: $key")); } @@ -317,7 +316,7 @@ class CRM_Utils_REST { } // Everyone should be required to provide the server key, so the whole - // interface can be disabled in more change to the configuration file. + // interface can be disabled in more change to the configuration file. // first check for civicrm site key if (!CRM_Utils_System::authenticateKey(FALSE)) { $docLink = CRM_Utils_System::docURL2("Managing Scheduled Jobs", TRUE, NULL, NULL, NULL, "wiki"); @@ -329,8 +328,7 @@ class CRM_Utils_REST { } // At this point we know we are not calling ping which does not require authentication. - // Therefore we now need a valid server key and API key - + // Therefore we now need a valid server key and API key. // Check and see if a valid secret API key is provided. $api_key = CRM_Utils_Request::retrieve('api_key', 'String', $store, FALSE, NULL, 'REQUEST'); if (!$api_key || strtolower($api_key) == 'null') { @@ -525,8 +523,9 @@ class CRM_Utils_REST { /** * This is a wrapper so you can call an api via json (it returns json too) - * http://example.org/civicrm/api/json?entity=Contact&action=Get"&json={"contact_type":"Individual","email.get.email":{}} to take all the emails from individuals - * works for POST & GET (POST recommended) + * http://example.org/civicrm/api/json?entity=Contact&action=Get"&json={"contact_type":"Individual","email.get.email":{}} + * to take all the emails from individuals. + * Works for POST & GET (POST recommended). */ public static function ajaxJson() { $requestParams = CRM_Utils_Request::exportValues(); diff --git a/CRM/Utils/ReCAPTCHA.php b/CRM/Utils/ReCAPTCHA.php index d2cbb51019..8d53f596ad 100644 --- a/CRM/Utils/ReCAPTCHA.php +++ b/CRM/Utils/ReCAPTCHA.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_ReCAPTCHA { @@ -63,9 +61,8 @@ class CRM_Utils_ReCAPTCHA { return self::$_singleton; } - /** - */ public function __construct() { + // Empty function? } /** diff --git a/CRM/Utils/Recent.php b/CRM/Utils/Recent.php index d73825dbc5..969e254d18 100644 --- a/CRM/Utils/Recent.php +++ b/CRM/Utils/Recent.php @@ -26,7 +26,6 @@ */ /** - * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 */ @@ -39,7 +38,7 @@ class CRM_Utils_Recent { /** * Max number of items in queue. * - * @int + * @var int */ const MAX_ITEMS = 10, STORE_NAME = 'CRM_Utils_Recent'; diff --git a/CRM/Utils/Request.php b/CRM/Utils/Request.php index ad47d01ad6..fd0c8fe0e9 100644 --- a/CRM/Utils/Request.php +++ b/CRM/Utils/Request.php @@ -29,13 +29,10 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** - * class for managing a http request - * + * Class for managing a http request */ class CRM_Utils_Request { diff --git a/CRM/Utils/Rule.php b/CRM/Utils/Rule.php index 5a0cf47a7c..12bcb6280f 100644 --- a/CRM/Utils/Rule.php +++ b/CRM/Utils/Rule.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ require_once 'HTML/QuickForm/Rule/Email.php'; @@ -81,7 +79,7 @@ class CRM_Utils_Rule { return FALSE; } - // make sure it include valid characters, alpha numeric and underscores + // make sure it includes valid characters, alpha numeric and underscores if (!preg_match('/^[\w]+$/i', $str)) { return FALSE; } @@ -101,7 +99,7 @@ class CRM_Utils_Rule { return FALSE; } - // make sure it include valid characters, alpha numeric and underscores + // make sure it includes valid characters, alpha numeric and underscores // added (. and ,) option (CRM-1336) if (!preg_match('/^[\w\s\.\,]+$/i', $str)) { return FALSE; @@ -121,7 +119,7 @@ class CRM_Utils_Rule { return FALSE; } - // make sure it include valid characters, (, \s and numeric + // make sure it includes valid characters, (, \s and numeric if (preg_match('/^[\d\(\)\-\.\s]+$/', $phone)) { return TRUE; } @@ -139,7 +137,7 @@ class CRM_Utils_Rule { return FALSE; } - // make sure it include valid characters, alpha numeric and underscores + // make sure it includes valid characters, alpha numeric and underscores if (!preg_match('/^[\w\s\%\'\&\,\$\#]+$/i', $query)) { return FALSE; } @@ -481,11 +479,11 @@ class CRM_Utils_Rule { public static function money($value) { $config = CRM_Core_Config::singleton(); - //only edge case when we have a decimal point in the input money - //field and not defined in the decimal Point in config settings + // only edge case when we have a decimal point in the input money + // field and not defined in the decimal Point in config settings if ($config->monetaryDecimalPoint && $config->monetaryDecimalPoint != '.' && - /* CRM-7122 also check for Thousands Separator in config settings */ + // CRM-7122 also check for Thousands Separator in config settings $config->monetaryThousandSeparator != '.' && substr_count($value, '.') ) { diff --git a/CRM/Utils/Signer.php b/CRM/Utils/Signer.php index ef8f9cf926..18b2337fef 100644 --- a/CRM/Utils/Signer.php +++ b/CRM/Utils/Signer.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** @@ -99,7 +97,8 @@ class CRM_Utils_Signer { $params[$paramName] = (string) $params[$paramName]; } } - else {// $paramName is not included or ===NULL + else { + // $paramName is not included or ===NULL $params[$paramName] = ''; } $message['payload'][$paramName] = $params[$paramName]; diff --git a/CRM/Utils/SoapServer.php b/CRM/Utils/SoapServer.php index cdf85618a0..15b528b246 100644 --- a/CRM/Utils/SoapServer.php +++ b/CRM/Utils/SoapServer.php @@ -95,7 +95,7 @@ class CRM_Utils_SoapServer { throw new SoapFault('Client', 'Expired key'); } - /* otherwise, we're ok. update the timestamp */ + // otherwise, we're ok. update the timestamp $session->set('soap_time', $t); } diff --git a/CRM/Utils/Sort.php b/CRM/Utils/Sort.php index 098ef0e4e6..8ebc4289ee 100644 --- a/CRM/Utils/Sort.php +++ b/CRM/Utils/Sort.php @@ -25,12 +25,6 @@ +--------------------------------------------------------------------+ */ -/** - * - * @package CRM - * @copyright CiviCRM LLC (c) 2004-2015 - */ - /** * * Base class to provide generic sort functionality. @@ -42,8 +36,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_Sort { @@ -257,7 +249,6 @@ class CRM_Utils_Sort { * * @return int * returns of the current sort id - * @acccess public */ public function getCurrentSortID() { return $this->_currentSortID; @@ -268,7 +259,6 @@ class CRM_Utils_Sort { * * @return int * returns of the current sort direction - * @acccess public */ public function getCurrentSortDirection() { return $this->_currentSortDirection; @@ -295,7 +285,7 @@ class CRM_Utils_Sort { } // else: $a and $b are equal wrt to this attribute, try next... } } - // if we get here, $a and $b es equal for all we know + // if we get here, $a and $b are equal for all we know // however, as I understand we don't want equality here: return -1; } diff --git a/CRM/Utils/String.php b/CRM/Utils/String.php index 77011a9135..fb99bfea70 100644 --- a/CRM/Utils/String.php +++ b/CRM/Utils/String.php @@ -29,14 +29,12 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ */ require_once 'HTML/QuickForm/Rule/Email.php'; /** * This class contains string functions. - * */ class CRM_Utils_String { const COMMA = ",", SEMICOLON = ";", SPACE = " ", TAB = "\t", LINEFEED = "\n", CARRIAGELINE = "\r\n", LINECARRIAGE = "\n\r", CARRIAGERETURN = "\r"; @@ -221,13 +219,13 @@ class CRM_Utils_String { $str = preg_replace('/\s+/', '', $str); // FIXME: This is a pretty brutal hack to make utf8 and 8859-1 work. - /* match low- or high-ascii characters */ + // match low- or high-ascii characters if (preg_match('/[\x00-\x20]|[\x7F-\xFF]/', $str)) { // || // low ascii characters // high ascii characters // preg_match( '/[\x7F-\xFF]/', $str ) ) { if ($utf8) { - /* if we did match, try for utf-8, or iso8859-1 */ + // if we did match, try for utf-8, or iso8859-1 return self::isUtf8($str); } @@ -260,7 +258,7 @@ class CRM_Utils_String { * array of strings w/ corresponding redacted outputs */ public static function regex($str, $regexRules) { - //redact the regular expressions + // redact the regular expressions if (!empty($regexRules) && isset($str)) { static $matches, $totalMatches, $match = array(); foreach ($regexRules as $pattern => $replacement) { @@ -298,14 +296,14 @@ class CRM_Utils_String { * @return mixed */ public static function redaction($str, $stringRules) { - //redact the strings + // redact the strings if (!empty($stringRules)) { foreach ($stringRules as $match => $replace) { $str = str_ireplace($match, $replace, $str); } } - //return the redacted output + // return the redacted output return $str; } @@ -322,11 +320,9 @@ class CRM_Utils_String { // eliminate all white space from the string $str = preg_replace('/\s+/', '', $str); - /* pattern stolen from the php.net function documentation for - * utf8decode(); - * comment by JF Sebastian, 30-Mar-2005 - */ - + // pattern stolen from the php.net function documentation for + // utf8decode(); + // comment by JF Sebastian, 30-Mar-2005 return preg_match('/^([\x00-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xec][\x80-\xbf]{2}|\xed[\x80-\x9f][\x80-\xbf]|[\xee-\xef][\x80-\xbf]{2}|f0[\x90-\xbf][\x80-\xbf]{2}|[\xf1-\xf3][\x80-\xbf]{3}|\xf4[\x80-\x8f][\x80-\xbf]{2})*$/', $str); // || // iconv('ISO-8859-1', 'UTF-8', $str); @@ -338,7 +334,7 @@ class CRM_Utils_String { } /** - * Determine if two href's are equivalent (fuzzy match) + * Determine if two hrefs are equivalent (fuzzy match) * * @param string $url1 * The first url to be matched. diff --git a/CRM/Utils/Sunlight.php b/CRM/Utils/Sunlight.php index cbc80b150f..bffa1ed972 100644 --- a/CRM/Utils/Sunlight.php +++ b/CRM/Utils/Sunlight.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_Sunlight { static $_apiURL = 'http://api.sunlightlabs.com/'; diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index 5d5e7d0833..e9c171b5aa 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -39,7 +39,8 @@ class CRM_Utils_System { static $_callbacks = NULL; /** - * @var string Page title + * @var string + * Page title */ static $title = ''; @@ -114,7 +115,7 @@ class CRM_Utils_System { list($name, $value) = explode('=', $qs[$i]); if ($name != $urlVar) { $name = rawurldecode($name); - //check for arrays in parameters: site.php?foo[]=1&foo[]=2&foo[]=3 + // check for arrays in parameters: site.php?foo[]=1&foo[]=2&foo[]=3 if ((strpos($name, '[') !== FALSE) && (strpos($name, ']') !== FALSE) ) { @@ -347,7 +348,7 @@ class CRM_Utils_System { * Uses the referer if valid else uses the default. * * @param array $names - * Refererer should match any str in this array. + * Referrer should match any str in this array. * @param string $default * (optional) The default userContext if no match found. */ @@ -798,7 +799,7 @@ class CRM_Utils_System { self::setHttpHeader('Content-Type', $mimeType); self::setHttpHeader('Expires', $now); - // lem9 & loic1: IE need specific headers + // lem9 & loic1: IE needs specific headers $isIE = strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE'); if ($ext) { $fileString = "filename=\"{$name}.{$ext}\""; @@ -862,7 +863,7 @@ class CRM_Utils_System { } // at some point we'll add code here to make sure the url is not - // something that will mess up up, so we need to clean it up here + // something that will mess up, so we need to clean it up here return $url; } @@ -1110,8 +1111,6 @@ class CRM_Utils_System { return $headers; } - /** - */ public static function getRequestHeaders() { if (function_exists('apache_request_headers')) { return apache_request_headers(); @@ -1134,8 +1133,6 @@ class CRM_Utils_System { strtolower($_SERVER['HTTPS']) != 'off') ? TRUE : FALSE; } - /** - */ public static function redirectToSSL($abort = FALSE) { $config = CRM_Core_Config::singleton(); $req_headers = self::getRequestHeaders(); @@ -1179,7 +1176,7 @@ class CRM_Utils_System { $config = CRM_Core_Config::singleton(); if ($config->userSystem->is_drupal && function_exists('ip_address')) { - //drupal function handles the server being behind a proxy securely. We still have legacy ipn methods + // drupal function handles the server being behind a proxy securely. We still have legacy ipn methods // that reach this point without bootstrapping hence the check that the fn exists $address = ip_address(); } @@ -1476,8 +1473,6 @@ class CRM_Utils_System { return $config->userSystem->getLoggedInUfID(); } - /** - */ public static function baseCMSURL() { static $_baseURL = NULL; if (!$_baseURL) { @@ -1673,7 +1668,6 @@ class CRM_Utils_System { } return $file_list; } - // listIncludeFiles() /** * Get a list of all "plugins" (PHP classes that implement a piece of @@ -1709,10 +1703,7 @@ class CRM_Utils_System { } return $plugins; } - // getPluginList() - /** - */ public static function executeScheduledJobs() { $facility = new CRM_Core_JobManager(); $facility->execute(FALSE); diff --git a/CRM/Utils/SystemLogger.php b/CRM/Utils/SystemLogger.php index f736a17f17..bfcdfe949c 100644 --- a/CRM/Utils/SystemLogger.php +++ b/CRM/Utils/SystemLogger.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Utils_SystemLogger extends Psr\Log\AbstractLogger implements \Psr\Log\LoggerInterface { /** @@ -39,7 +37,6 @@ class CRM_Utils_SystemLogger extends Psr\Log\AbstractLogger implements \Psr\Log\ * @param mixed $level * @param string $message * @param array $context - * */ public function log($level, $message, array $context = array()) { if (!isset($context['hostname'])) { diff --git a/CRM/Utils/Time.php b/CRM/Utils/Time.php index fddc018848..73e5dd39d4 100644 --- a/CRM/Utils/Time.php +++ b/CRM/Utils/Time.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** @@ -39,7 +37,8 @@ class CRM_Utils_Time { /** - * @var int, the seconds offset from the real world time + * @var int + * the seconds offset from the real world time */ static private $_delta = 0; @@ -50,7 +49,6 @@ class CRM_Utils_Time { * Format in which date is to be retrieved. * * @return date - * */ public static function getTime($returnFormat = 'YmdHis') { return date($returnFormat, self::getTimeRaw()); @@ -59,7 +57,8 @@ class CRM_Utils_Time { /** * Get the time. * - * @return int, seconds since epoch + * @return int + * seconds since epoch */ public static function getTimeRaw() { return time() + self::$_delta; @@ -74,7 +73,6 @@ class CRM_Utils_Time { * Format in which date is to be retrieved. * * @return date - * */ public static function setTime($newDateTime, $returnFormat = 'YmdHis') { self::$_delta = strtotime($newDateTime) - time(); diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index d6ade96ce1..e4eeb41fa1 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -288,7 +288,7 @@ class CRM_Utils_Token { } $value = NULL; - /* Construct the address token */ + // Construct the address token if (!empty($loc[$token])) { if ($html) { @@ -305,7 +305,7 @@ class CRM_Utils_Token { $value = $domain->$token; } elseif ($token == 'phone' || $token == 'email') { - /* Construct the phone and email tokens */ + // Construct the phone and email tokens $value = NULL; if (!empty($loc[$token])) { @@ -352,13 +352,13 @@ class CRM_Utils_Token { continue; } - /* If the string doesn't contain this token, skip it. */ + // If the string doesn't contain this token, skip it. if (!self::token_match('org', $token, $str)) { continue; } - /* Construct value from $token and $contact */ + // Construct value from $token and $contact $value = NULL; @@ -379,7 +379,7 @@ class CRM_Utils_Token { $value = "cs={$cs}"; } elseif ($token == 'address') { - /* Build the location values array */ + // Build the location values array $loc = array(); $loc['display_name'] = CRM_Utils_Array::retrieveValueRecursive($org, 'display_name'); @@ -388,7 +388,7 @@ class CRM_Utils_Token { $loc['state_province'] = CRM_Utils_Array::retrieveValueRecursive($org, 'state_province'); $loc['postal_code'] = CRM_Utils_Array::retrieveValueRecursive($org, 'postal_code'); - /* Construct the address token */ + // Construct the address token $value = CRM_Utils_Address::format($loc); if ($html) { @@ -419,7 +419,7 @@ class CRM_Utils_Token { * @param bool $escapeSmarty * * @return string - * The processed sstring + * The processed string */ public static function &replaceMailingTokens( $str, @@ -594,8 +594,8 @@ class CRM_Utils_Token { $html = FALSE, $escapeSmarty = FALSE ) { - /* If the token is an email action, use it. Otherwise, find the - * appropriate URL */ + // If the token is an email action, use it. Otherwise, find the + // appropriate URL. if (!in_array($token, self::$_tokens['action'])) { $value = "{action.$token}"; @@ -608,7 +608,7 @@ class CRM_Utils_Token { } if ($value && $html) { - //fix for CRM-2318 + // fix for CRM-2318 if ((substr($token, -3) != 'Url') && ($token != 'forward')) { $value = "mailto:$value"; } @@ -654,7 +654,7 @@ class CRM_Utils_Token { ) { $key = 'contact'; if (self::$_tokens[$key] == NULL) { - /* This should come from UF */ + // This should come from UF self::$_tokens[$key] = array_merge( @@ -709,7 +709,7 @@ class CRM_Utils_Token { ); } - /* Construct value from $token and $contact */ + // Construct value from $token and $contact $value = NULL; $noReplace = FALSE; @@ -858,10 +858,10 @@ class CRM_Utils_Token { } /** - * unescapeTokens removes any characters that caused the replacement routines to skip token replacement - * for example {{token}} or \{token} will result in {token} in the final email + * unescapeTokens removes any characters that caused the replacement routines to skip token replacement + * for example {{token}} or \{token} will result in {token} in the final email * - * this routine will remove the extra backslashes and braces + * this routine will remove the extra backslashes and braces * * @param $str ref to the string that will be scanned and modified */ @@ -1247,7 +1247,7 @@ class CRM_Utils_Token { ) { $pcm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method'); - // communication Prefferance + // communication Preference $contactPcm = explode(CRM_Core_DAO::VALUE_SEPARATOR, $contactDetails[$contactID]['preferred_communication_method'] ); @@ -1268,7 +1268,7 @@ class CRM_Utils_Token { } } - //special case for greeting replacement + // special case for greeting replacement foreach (array( 'email_greeting', 'postal_greeting', @@ -1352,8 +1352,8 @@ class CRM_Utils_Token { $tokens = array(), $className = NULL ) { - //@todo - this function basically replicates calling - //civicrm_api3('contribution', 'get', array('id' => array('IN' => array()) + // @todo this function basically replicates calling + // civicrm_api3('contribution', 'get', array('id' => array('IN' => array()) if (empty($contributionIDs)) { // putting a fatal here so we can track if/when this happens CRM_Core_Error::fatal(); @@ -1390,7 +1390,7 @@ class CRM_Utils_Token { $details[$dao->id]['financial_type'] = $ftis[$financialtypeId]; } - // TODO: call a hook to get token contribution details + // @todo call a hook to get token contribution details } } @@ -1411,7 +1411,7 @@ class CRM_Utils_Token { } /** - * Replace greeting tokens exists in message/subject + * Replace existing greeting tokens in message/subject. */ public static function replaceGreetingTokens(&$tokenString, $contactDetails = NULL, $contactId = NULL, $className = NULL, $escapeSmarty = FALSE) { @@ -1573,8 +1573,6 @@ class CRM_Utils_Token { return $value; } - /** - */ protected static function _buildContributionTokens() { $key = 'contribution'; if (self::$_tokens[$key] == NULL) { @@ -1618,7 +1616,7 @@ class CRM_Utils_Token { } $fn = 'get' . ucfirst($entity) . 'tokenReplacement'; - //since we already know the tokens lets just use them & do str_replace which is faster & simpler than preg_replace + // since we already know the tokens lets just use them & do str_replace which is faster & simpler than preg_replace foreach ($knownTokens[$entity] as $token) { $replaceMent = CRM_Utils_Token::$fn($token, $entityArray, $escapeSmarty); $str = str_replace('{' . $entity . '.' . $token . '}', $replaceMent, $str); @@ -1740,7 +1738,7 @@ class CRM_Utils_Token { $value = $membership[$token]; } else { - //ie unchanged + // ie unchanged $value = "{$entity}.{$token}"; } break; @@ -1818,7 +1816,7 @@ class CRM_Utils_Token { natcasesort($tokens); // Attempt to place tokens into optgroups - // TODO: These groupings could be better and less hackish. Getting them pre-grouped from upstream would be nice. + // @todo These groupings could be better and less hackish. Getting them pre-grouped from upstream would be nice. foreach ($tokens as $k => $v) { // Check to see if this token is already in a group e.g. for custom fields $split = explode(' :: ', $v); diff --git a/CRM/Utils/Tree.php b/CRM/Utils/Tree.php index cc526ae474..819e7a1487 100644 --- a/CRM/Utils/Tree.php +++ b/CRM/Utils/Tree.php @@ -69,12 +69,6 @@ * 'name' - string * 'children' - array * 'data' - array - * - * - * @package CRM - * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Tree { diff --git a/CRM/Utils/Type.php b/CRM/Utils/Type.php index 5e12acd9ba..5cb4b831cd 100644 --- a/CRM/Utils/Type.php +++ b/CRM/Utils/Type.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Type { const diff --git a/CRM/Utils/Verp.php b/CRM/Utils/Verp.php index 71a59b9136..0c77f2dd95 100644 --- a/CRM/Utils/Verp.php +++ b/CRM/Utils/Verp.php @@ -31,8 +31,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_Verp { /* Mapping of reserved characters to hex codes */ diff --git a/CRM/Utils/VersionCheck.php b/CRM/Utils/VersionCheck.php index c04e6310a9..380c4b61db 100644 --- a/CRM/Utils/VersionCheck.php +++ b/CRM/Utils/VersionCheck.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id: $ - * */ class CRM_Utils_VersionCheck { const diff --git a/CRM/Utils/Weight.php b/CRM/Utils/Weight.php index 419105d171..c5d01a6598 100644 --- a/CRM/Utils/Weight.php +++ b/CRM/Utils/Weight.php @@ -46,7 +46,7 @@ class CRM_Utils_Weight { * @param array $fieldValues * Field => value to be used in the WHERE. * @param string $weightField - * Field which contains the weight value,. + * Field which contains the weight value. * defaults to 'weight' * * @return bool @@ -70,7 +70,7 @@ class CRM_Utils_Weight { } if ($minDupeID->dupeId && $status) { - //recursive call to correct all duplicate weight entries. + // recursive call to correct all duplicate weight entries. return CRM_Utils_Weight::correctDuplicateWeights($daoName, $fieldValues, $weightField); } elseif (!$minDupeID->dupeId) { @@ -93,7 +93,7 @@ class CRM_Utils_Weight { * @param array $fieldValues * Field => value to be used in the WHERE. * @param string $weightField - * Field which contains the weight value,. + * Field which contains the weight value. * defaults to 'weight' * * @return bool @@ -146,10 +146,10 @@ class CRM_Utils_Weight { } if ($newWeight > $maxWeight) { - //calculate new weight, CRM-4133 + // calculate new weight, CRM-4133 $calNewWeight = CRM_Utils_Weight::getNewWeight($daoName, $fieldValues, $weightField); - //no need to update weight for other fields. + // no need to update weight for other fields. if ($calNewWeight > $maxWeight) { return $calNewWeight; } @@ -217,7 +217,7 @@ class CRM_Utils_Weight { if ($sameWeightCount) { $newWeight = max($weights) + 1; - //check for max wt should not greater than cal max wt. + // check for max wt, should not greater than cal max wt. $calMaxWt = min($weights) + count($weights) - 1; if ($newWeight > $calMaxWt) { $newWeight = $calMaxWt; @@ -238,7 +238,7 @@ class CRM_Utils_Weight { * @param array $fieldValues * Field => value to be used in the WHERE. * @param string $weightField - * Field which contains the weight value,. + * Field which contains the weight value. * defaults to 'weight' * * @return int @@ -261,7 +261,7 @@ class CRM_Utils_Weight { * @param array $fieldValues * Field => value to be used in the WHERE. * @param string $weightField - * Field which contains the weight value,. + * Field which contains the weight value. * defaults to 'weight' * * @return int diff --git a/CRM/Utils/XML.php b/CRM/Utils/XML.php index 5df6df81ae..c5fb7669ce 100644 --- a/CRM/Utils/XML.php +++ b/CRM/Utils/XML.php @@ -28,7 +28,6 @@ /** * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ */ class CRM_Utils_XML { diff --git a/CRM/Utils/Zip.php b/CRM/Utils/Zip.php index 03e02cb537..ad5ee42b98 100644 --- a/CRM/Utils/Zip.php +++ b/CRM/Utils/Zip.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** @@ -43,7 +41,8 @@ class CRM_Utils_Zip { * * @param ZipArchive $zip * - * @return mixed; FALSE if #root level items !=1; otherwise, the name of base dir + * @return mixed + * FALSE if #root level items !=1; otherwise, the name of base dir */ static public function findBaseDirName(ZipArchive $zip) { $cnt = $zip->numFiles; @@ -75,7 +74,8 @@ class CRM_Utils_Zip { * * @param ZipArchive $zip * - * @return array(string), no trailing / + * @return array(string) + * no trailing / */ static public function findBaseDirs(ZipArchive $zip) { $cnt = $zip->numFiles; @@ -98,8 +98,8 @@ class CRM_Utils_Zip { * @param ZipArchive $zip * @param $expected * - * @return string - * or FALSE + * @return string|bool + * Return string or FALSE */ static public function guessBasedir(ZipArchive $zip, $expected) { $candidate = FALSE; -- 2.25.1