*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
require_once 'api/Wrapper.php';
public abstract function decodeOutput(&$values);
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
public function fromApiInput($apiRequest) {
$lowerAction = strtolower($apiRequest['action']);
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
public function toApiOutput($apiRequest, $result) {
$lowerAction = strtolower($apiRequest['action']);
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_API_HTMLInputCoder extends CRM_Utils_API_AbstractFieldCoder {
private $skipFields = NULL;
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
*/
require_once 'api/Wrapper.php';
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
public function fromApiInput($apiRequest) {
break;
default:
- // be forgiveful of sloppily api calls
+ // be forgiving of sloppy api calls
}
}
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
public function toApiOutput($apiRequest, $result) {
return $result;
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
*/
require_once 'api/Wrapper.php';
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
/**
* @param $apiRequest
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
*/
require_once 'api/Wrapper.php';
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
public function fromApiInput($apiRequest) {
return $apiRequest;
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
public function toApiOutput($apiRequest, $result) {
$reloadMode = NULL;
*/
/**
- * Address utilties
+ * Address Utilities
*
* @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
*/
class CRM_Utils_Address {
+--------------------------------------------------------------------+
*/
+/**
+ *
+ * @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 {
*/
/**
- *
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
$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;
/**
* Diff multidimensional arrays
- * ( array_diff does not support multidimensional array)
+ * (array_diff does not support multidimensional array)
*
* @param array $array1
* @param array $array2
-<?php /*
+<?php
+/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
*/
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ */
+
/**
* Class CRM_Utils_AutoClean
*
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* Cache is an empty base object, we'll modify the scheme when we have different caching schemes
- *
*/
class CRM_Utils_Cache {
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_Cache_APCcache implements CRM_Utils_Cache_Interface {
const DEFAULT_TIMEOUT = 3600;
<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.7 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ */
/**
* Class CRM_Utils_Cache_Arraycache
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_Cache_Memcache implements CRM_Utils_Cache_Interface {
const DEFAULT_HOST = 'localhost';
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_Cache_Memcached implements CRM_Utils_Cache_Interface {
const DEFAULT_HOST = 'localhost';
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_Cache_NoCache implements CRM_Utils_Cache_Interface {
<?php
/*
+--------------------------------------------------------------------+
-| CiviCRM version 4.7 |
-+--------------------------------------------------------------------+
-| Copyright CiviCRM LLC (c) 2004-2015 |
-+--------------------------------------------------------------------+
-| This file is a part of CiviCRM. |
-| |
-| CiviCRM is free software; you can copy, modify, and distribute it |
-| under the terms of the GNU Affero General Public License |
-| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
-| |
-| CiviCRM is distributed in the hope that it will be useful, but |
-| WITHOUT ANY WARRANTY; without even the implied warranty of |
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
-| See the GNU Affero General Public License for more details. |
-| |
-| You should have received a copy of the GNU Affero General Public |
-| License and the CiviCRM Licensing Exception along |
-| with this program; if not, contact CiviCRM LLC |
-| at info[AT]civicrm[DOT]org. If you have questions about the |
-| GNU Affero General Public License or the licensing of CiviCRM, |
-| see the CiviCRM license FAQ at http://civicrm.org/licensing |
-+--------------------------------------------------------------------+
+ | CiviCRM version 4.7 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_Check {
- const
- // How often to run checks and notify admins about issues.
- CHECK_TIMER = 86400;
+ // How often to run checks and notify admins about issues.
+ const CHECK_TIMER = 86400;
/**
* We only need one instance of this object, so we use the
$statusMessage = '<ul><li>' . implode('</li><li>', $statusMessages) . '</li></ul>';
}
- // TODO: add link to status page
+ // @todo add link to status page
CRM_Core_Session::setStatus($statusMessage, $statusTitle, $statusType);
}
}
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_Check_Case {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
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;
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_Check_Message {
/**
*
* @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() {
* Array of messages
* @see CRM-14091
*
- * @TODO: Test with WordPress, Joomla.
+ * @todo Test with WordPress, Joomla.
*/
public function checkUploadsAreNotAccessible() {
$messages = array();
* Array of messages
* @see CRM-14091
*
- * @TODO: Test with WordPress, Joomla.
+ * @todo Test with WordPress, Joomla.
*/
public function checkDirectoriesAreNotBrowseable() {
$messages = array();
$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(
+--------------------------------------------------------------------+
*/
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ */
+
/**
* Class CRM_Utils_Constant
*/
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_Crypt {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
*
* @return string
* formatted string for date
- *
*/
public static function format($date, $separator = '', $invalidDate = 0) {
if (is_numeric($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;
}
$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;
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;
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;
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']));
$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;
$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];
}
/**
- * Function to process date, convert to mysql format
+ * Function to process date, convert to mysql format
*
* @param string $date
* Date string.
}
/**
- * Function to convert mysql to date plugin format.
+ * Function to convert mysql to date plugin format.
*
* @param string $mysqlDate
* Date string.
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);
$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;
+--------------------------------------------------------------------+
*/
+/**
+ *
+ * @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
continue;
}
- //Handling Custom Data
+ // Handling Custom Data
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
$values[$key] = $value;
$type = $customFields[$customFieldID]['html_type'];
continue;
}
- //Handling Custom Data
+ // Handling Custom Data
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
$values[$key] = $value;
$type = $customFields[$customFieldID]['html_type'];
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);
}
}
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'];
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])) {
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'])
) {
}
}
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])) {
$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);
$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']);
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;
}
* @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();
return TRUE;
}
- //CRM-4575
+ // CRM-4575
if (isset($values['email_greeting'])) {
if (!empty($params['email_greeting_id'])) {
$emailGreetingFilter = array(
return TRUE;
}
- //format the website params.
+ // format the website params.
if (!empty($values['url'])) {
static $websiteFields;
if (!is_array($websiteFields)) {
}
if (isset($values['note'])) {
- /* add a note field */
+ // add a note field
if (!isset($params['note'])) {
$params['note'] = array();
}
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),
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');
* @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) {
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.');
}
}
}
- /* 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)) {
*/
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'];
}
}
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'];
}
}
- //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)) {
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']}";
}
}
- //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'];
}
/**
- *
* @param $result
* @param int $activityTypeID
*
<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.7 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ */
/**
* This is a quick-and-dirty way to define a vaguely-class-ish structure. It's non-performant, abnormal,
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
/**
* The path name.
* @param bool $abort
* Should we abort or just return an invalid code.
- *
- * @return void
*/
public static function createDir($path, $abort = TRUE) {
if (is_dir($path) || empty($path)) {
* @param bool $verbose
*
* @throws Exception
- * @return void
*/
public static function cleanDir($target, $rmdir = TRUE, $verbose = TRUE) {
static $exceptions = array('.', '..');
*/
public static function addTrailingSlash($path, $slash = NULL) {
if (!$slash) {
- // FIXME: Defaulting to backslash on windows systems can produce unexpected results, esp for URL strings which should always use forward-slashes.
+ // FIXME: Defaulting to backslash on windows systems can produce
+ // unexpected results, esp for URL strings which should always use forward-slashes.
// I think this fn should default to forward-slash instead.
$slash = DIRECTORY_SEPARATOR;
}
$string = $prefix . $fileName;
}
- //get rid of comments starting with # and --
+ // get rid of comments starting with # and --
$string = preg_replace("/^#[^\n]*$/m", "\n", $string);
$string = preg_replace("/^(--[^-]).*/m", "\n", $string);
if (!$extensions) {
$extensions = CRM_Core_OptionGroup::values('safe_file_extension', TRUE);
- //make extensions to lowercase
+ // make extensions to lowercase
$extensions = array_change_key_case($extensions, CASE_LOWER);
// allow html/htm extension ONLY if the user is admin
// and/or has access CiviMail
unset($extensions['htm']);
}
}
- //support lower and uppercase file extensions
+ // support lower and uppercase file extensions
return isset($extensions[strtolower($ext)]) ? TRUE : FALSE;
}
/**
* Create a path to a temporary file 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
*
* @see tempnam
*/
public static function tempnam($prefix = 'tmp-') {
- //$config = CRM_Core_Config::singleton();
- //$nonce = md5(uniqid() . $config->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;
}
/**
* 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
*
}
}
- // 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)) {
+--------------------------------------------------------------------+
*/
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ */
+
/**
* Class CRM_Utils_Geocode
*/
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
+--------------------------------------------------------------------+
*/
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ */
+
/**
* Temporarily change a global variable.
*
// 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;
* 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,
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);
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_Hook_Drupal extends CRM_Utils_Hook_DrupalBase {
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_Hook_Drupal6 extends CRM_Utils_Hook_DrupalBase {
}
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_Hook_Drupal8 extends CRM_Utils_Hook_DrupalBase {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_Hook_DrupalBase extends CRM_Utils_Hook {
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_Hook_Joomla extends CRM_Utils_Hook {
/**
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_Hook_Soap extends CRM_Utils_Hook {
/**
*
* @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;
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
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)) {
$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')) {
}
- /**
- * 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();
// 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')) {
<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.7 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+/**
+ *
+ * @package CiviCRM_Hook
+ * @copyright CiviCRM LLC (c) 2004-2015
+ */
class CRM_Utils_Http {
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_HttpClient {
protected static $singleton;
/**
- * @var int|NULL seconds; or NULL to use system default
+ * @var int|NULL
+ * seconds; or NULL to use system default
*/
protected $connectionTimeout;
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);
}
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);
}
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_JS {
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
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"), '<br />', $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;
}
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
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]);
// 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);
}
* 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);
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 <html> 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 <html> tag even if you do not include it.
$html = preg_replace('/(<html)(.+?xmlns=["\'].[^\s]+["\'])(.+)?(>)/', '\1\3\4', $html);
file_put_contents($pdf_filename, CRM_Utils_PDF_Utils::html2pdf($html,
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_Mail_Incoming {
const
*/
protected $_xml;
- /**
- */
public function __construct() {
$this->_xml = array(
'customGroup' => array(
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_Migrate_ExportJSON {
const CHUNK_SIZE = 128;
}
/**
- * TODO - support group inheritance
+ * @todo support group inheritance
+ *
* Parent child group ids are encoded in a text string
+ *
* @param $contactIDs
*/
public function group(&$contactIDs) {
}
/**
- * TODO - support search builder and custom saved searches
+ * @todo support search builder and custom saved searches
* @param $groupIDs
*/
public function savedSearch(&$groupIDs) {
$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
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_Migrate_ImportJSON {
protected $_saveMapping;
- /**
- */
public function __construct() {
$this->_lookupCache = array();
$this->_saveMapping = array();
$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);
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
*/
/**
- *
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
/**
<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.7 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ */
/**
* Class CRM_Utils_Number
* (int $significantDigits, int $postDecimalDigits).
*
* @return float
+ *
* @link https://dev.mysql.com/doc/refman/5.1/en/fixed-point-types.html
*/
public static function createRandomDecimal($precision) {
list ($sigFigs, $decFigs) = $precision;
$sign = ($keyValue < 0) ? '-1' : 1;
$val = str_replace('.', '', abs($keyValue)); // ex: -123.456 ==> 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);
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) <a href='%1'>Administrator >> System Settings >> Misc</a>. 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");
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
require_once 'packages/OpenFlashChart/php-ofc-library/open-flash-chart.php';
$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.
$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);
}
$graphTitle = !empty($params['legend']) ? $params['legend'] : ts('Pie Chart');
- //get the currency.
+ // get the currency.
$config = CRM_Core_Config::singleton();
$symbol = $config->defaultCurrencySymbol;
$pie->set_values($values);
- //create chart.
+ // create chart.
$chart = new open_flash_chart();
// create chart title obj.
$chartTitle = !empty($params['legend']) ? $params['legend'] : ts('Bar Chart');
- //set y axis parameters.
+ // set y axis parameters.
$yMin = 0;
// calculate max scale for graph.
$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);
$chartData['tip'] = $rows['tip'];
}
- //legend
+ // legend
$chartData['xname'] = CRM_Utils_Array::value('xname', $rows);
$chartData['yname'] = CRM_Utils_Array::value('yname', $rows);
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;
}
<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.7 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ */
/**
* Class CRM_Utils_OptionBag.
}
/**
- * (PHP 5 >= 5.0.0)<br/>
+ * (PHP 5 >= 5.0.0)
* Whether a offset exists
* @link http://php.net/manual/en/arrayaccess.offsetexists.php
+ *
* @param mixed $offset
- * <p>.
- * An offset to check for.
- * </p>
+ * An offset to check for.
+ *
* @return bool
* true on success or false on failure.
- * </p>
- * <p>
* The return value will be casted to boolean if non-boolean was returned.
*/
public function offsetExists($offset) {
}
/**
- * (PHP 5 >= 5.0.0)<br/>
+ * (PHP 5 >= 5.0.0)
* Offset to retrieve
* @link http://php.net/manual/en/arrayaccess.offsetget.php
+ *
* @param mixed $offset
- * <p>.
- * The offset to retrieve.
- * </p>
+ * The offset to retrieve.
+ *
* @return mixed
* Can return all value types.
*/
}
/**
- * (PHP 5 >= 5.0.0)<br/>
+ * (PHP 5 >= 5.0.0)
* Offset to set
* @link http://php.net/manual/en/arrayaccess.offsetset.php
+ *
* @param mixed $offset
- * <p>.
- * The offset to assign the value to.
- * </p>
+ * The offset to assign the value to.
+ *
* @param mixed $value
- * <p>.
- * The value to set.
- * </p>
+ * The value to set.
*/
public function offsetSet($offset, $value) {
$this->data[$offset] = $value;
}
/**
- * (PHP 5 >= 5.0.0)<br/>
+ * (PHP 5 >= 5.0.0)
* Offset to unset
* @link http://php.net/manual/en/arrayaccess.offsetunset.php
+ *
* @param mixed $offset
- * <p>.
- * The offset to unset.
- * </p>
+ * The offset to unset.
*/
public function offsetUnset($offset) {
unset($this->data[$offset]);
}
/**
- * (PHP 5 >= 5.0.0)<br/>
+ * (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 <b>Iterator</b> or
- * <b>Traversable</b>
+ * An instance of an object implementing Iterator or
+ * Traversable
*/
public function getIterator() {
return new ArrayIterator($this->data);
}
/**
- * (PHP 5 >= 5.1.0)<br/>
+ * (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.
- * </p>
- * <p>
* The return value is cast to an integer.
*/
public function count() {
*/
/**
- * 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';
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_PDF_Utils {
*/
/**
- *
* @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
/**
* 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;
/**
* 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 => '<input size="2" maxlength="3" name="' . self::PAGE_ID . '" type="text" value="' . $this->_response['currentPage'] . '" />',
* @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;
*/
/**
- *
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* This class is for displaying alphabetical bar
- *
*/
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(
* @param $isDAO
*
* @return array
- * is a array of dynamic characters
+ * is an array of dynamic characters
*/
public static function getDynamicCharacters(&$query, $isDAO) {
if ($isDAO) {
sort($AToZBar, SORT_STRING);
$AToZBar = array_unique($AToZBar);
- //get the current path
+ // get the current path
$path = CRM_Utils_System::currentPath();
$qfKey = NULL;
+--------------------------------------------------------------------+
*/
+/**
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ */
+
/**
* Utilities for manipulating/inspecting CRM_*_PseudoConstant classes.
*/
);
/**
- * @var array ($name => $className)
+ * @var array
+ * ($name => $className)
*/
private static $constants = NULL;
+--------------------------------------------------------------------+
*/
+ /**
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ */
+
/**
* Class CRM_Utils_QueryFormatter
*
}
/**
- * @var string eg MODE_NONE
+ * @var string
+ * eg MODE_NONE
*/
protected $mode;
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- *
*/
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"));
}
}
// 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");
}
// 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') {
/**
* 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();
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_ReCAPTCHA {
return self::$_singleton;
}
- /**
- */
public function __construct() {
+ // Empty function?
}
/**
*/
/**
- *
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
*/
/**
* Max number of items in queue.
*
- * @int
+ * @var int
*/
const MAX_ITEMS = 10, STORE_NAME = 'CRM_Utils_Recent';
*
* @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 {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
require_once 'HTML/QuickForm/Rule/Email.php';
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;
}
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;
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;
}
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;
}
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, '.')
) {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
$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];
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);
}
+--------------------------------------------------------------------+
*/
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- */
-
/**
*
* Base class to provide generic sort functionality.
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_Sort {
*
* @return int
* returns of the current sort id
- * @acccess public
*/
public function getCurrentSortID() {
return $this->_currentSortID;
*
* @return int
* returns of the current sort direction
- * @acccess public
*/
public function getCurrentSortDirection() {
return $this->_currentSortDirection;
} // 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;
}
*
* @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";
$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);
}
* 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) {
* @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;
}
// 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);
}
/**
- * 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.
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_Sunlight {
static $_apiURL = 'http://api.sunlightlabs.com/';
static $_callbacks = NULL;
/**
- * @var string Page title
+ * @var string
+ * Page title
*/
static $title = '';
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)
) {
* 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.
*/
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}\"";
}
// 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;
}
return $headers;
}
- /**
- */
public static function getRequestHeaders() {
if (function_exists('apache_request_headers')) {
return apache_request_headers();
strtolower($_SERVER['HTTPS']) != 'off') ? TRUE : FALSE;
}
- /**
- */
public static function redirectToSSL($abort = FALSE) {
$config = CRM_Core_Config::singleton();
$req_headers = self::getRequestHeaders();
$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();
}
return $config->userSystem->getLoggedInUfID();
}
- /**
- */
public static function baseCMSURL() {
static $_baseURL = NULL;
if (!$_baseURL) {
}
return $file_list;
}
- // listIncludeFiles()
/**
* Get a list of all "plugins" (PHP classes that implement a piece of
}
return $plugins;
}
- // getPluginList()
- /**
- */
public static function executeScheduledJobs() {
$facility = new CRM_Core_JobManager();
$facility->execute(FALSE);
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Utils_SystemLogger extends Psr\Log\AbstractLogger implements \Psr\Log\LoggerInterface {
/**
* @param mixed $level
* @param string $message
* @param array $context
- *
*/
public function log($level, $message, array $context = array()) {
if (!isset($context['hostname'])) {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
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;
* Format in which date is to be retrieved.
*
* @return date
- *
*/
public static function getTime($returnFormat = 'YmdHis') {
return date($returnFormat, self::getTimeRaw());
/**
* Get the time.
*
- * @return int, seconds since epoch
+ * @return int
+ * seconds since epoch
*/
public static function getTimeRaw() {
return time() + self::$_delta;
* Format in which date is to be retrieved.
*
* @return date
- *
*/
public static function setTime($newDateTime, $returnFormat = 'YmdHis') {
self::$_delta = strtotime($newDateTime) - time();
}
$value = NULL;
- /* Construct the address token */
+ // Construct the address token
if (!empty($loc[$token])) {
if ($html) {
$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])) {
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;
$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');
$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) {
* @param bool $escapeSmarty
*
* @return string
- * The processed sstring
+ * The processed string
*/
public static function &replaceMailingTokens(
$str,
$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}";
}
if ($value && $html) {
- //fix for CRM-2318
+ // fix for CRM-2318
if ((substr($token, -3) != 'Url') && ($token != 'forward')) {
$value = "mailto:$value";
}
) {
$key = 'contact';
if (self::$_tokens[$key] == NULL) {
- /* This should come from UF */
+ // This should come from UF
self::$_tokens[$key]
= array_merge(
);
}
- /* Construct value from $token and $contact */
+ // Construct value from $token and $contact
$value = NULL;
$noReplace = FALSE;
}
/**
- * 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
*/
) {
$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']
);
}
}
- //special case for greeting replacement
+ // special case for greeting replacement
foreach (array(
'email_greeting',
'postal_greeting',
$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();
$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
}
}
}
/**
- * 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) {
return $value;
}
- /**
- */
protected static function _buildContributionTokens() {
$key = 'contribution';
if (self::$_tokens[$key] == NULL) {
}
$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);
$value = $membership[$token];
}
else {
- //ie unchanged
+ // ie unchanged
$value = "{$entity}.{$token}";
}
break;
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);
* 'name' - string
* 'children' - array
* 'data' - array
- *
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_Tree {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_Type {
const
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_Verp {
/* Mapping of reserved characters to hex codes */
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
*/
class CRM_Utils_VersionCheck {
const
* @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
}
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) {
* @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
}
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;
}
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;
* @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
* @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
/**
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
*/
class CRM_Utils_XML {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
*
* @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;
*
* @param ZipArchive $zip
*
- * @return array(string), no trailing /
+ * @return array(string)
+ * no trailing /
*/
static public function findBaseDirs(ZipArchive $zip) {
$cnt = $zip->numFiles;
* @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;