*
* @param array $fields
* The input form values.
+ * @param array $files
* @param CRM_Admin_Form_ScheduleReminders $self
*
- * @return bool|array
- * true if no errors, else array of errors
+ * @return array|bool
+ * True if no errors, else array of errors
*/
public static function formRule($fields, $files, $self) {
$errors = array();
/**
* Get Survey activity types.
+ *
+ * @param string $returnColumn
+ * @param bool $includePetitionActivityType
*/
public static function getSurveyActivityType($returnColumn = 'label', $includePetitionActivityType = FALSE) {
static $activityTypes;
/**
* Decides the contact type for given survey.
+ *
+ * @param int $surveyId
+ *
+ * @return null|string
*/
public static function getSurveyContactType($surveyId) {
$contactType = NULL;
*
* @param bool $excludeHidden
*
- * @return array (reference)|int $values
- * the relevant data object values for the contact or
- * the total count when $count is TRUE
+ * @param int $groupId
+ *
+ * @return array|int $values
+ * the relevant data object values for the contact or the total count when $count is TRUE
*/
public static function &getContactGroup(
$contactId,
}
/**
- * Do the set default related to location type id,
- * primary location, default country
+ * Do the set default related to location type id, primary location, default country.
+ *
+ * @param array $defaults
*/
public function blockSetDefaults(&$defaults) {
$locationTypeKeys = array_filter(array_keys(CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')), 'is_int');
}
/**
- * Add a form rule for this form. If Go is pressed then we must select some checkboxes
- * and an action
+ * Add a form rule for this form.
+ *
+ * If Go is pressed then we must select some checkboxes and an action.
+ *
+ * @param array $fields
+ *
+ * @return array|bool
*/
public static function formRule($fields) {
// check actionName and if next, then do not repeat a search, since we are going to the next page
}
/**
- * CRM-10338
- * tags and groups use array keys for selection list.
+ * CRM-10338 tags and groups use array keys for selection list.
+ *
* if using IS NULL/NOT NULL, an array with no array key is created
* convert that to simple NULL so processing can proceed
+ *
+ * @param string $val
+ *
+ * @return null
*/
public static function checkArrayKeyEmpty($val) {
if (is_array($val)) {
}
/**
- * The value is in string format. convert the value to the type of this field
+ * The value is in string format.
+ *
+ * Convert the value to the type of this field
* and set the field value with the appropriate type
+ *
+ * @param mixed $value
*/
public function setValue($value) {
$this->_value = $value;
}
/**
+ * Validate something we didn't document.
+ *
* @return bool
*/
public function validate() {
/**
* Swap contacts in a dupe pair i.e main with duplicate contact.
+ *
+ * @param int $prevNextId
*/
public static function flipDupePairs($prevNextId = NULL) {
if (!$prevNextId) {
}
$query = "
UPDATE civicrm_prevnext_cache cpc
- INNER JOIN civicrm_prevnext_cache old on cpc.id = old.id
+ INNER JOIN civicrm_prevnext_cache old on cpc.id = old.id
SET cpc.entity_id1 = cpc.entity_id2, cpc.entity_id2 = old.entity_id1 ";
if (is_array($prevNextId) && !CRM_Utils_Array::crmIsEmptyArray($prevNextId)) {
$prevNextId = implode(', ', $prevNextId);
/**
* CRM-16285 - Function to handle validation errors on form, for recurring contribution field.
+ *
* @param array $fields
* The input form values.
* @param array $files
* The uploaded files if any.
- * @param $self
+ * @param CRM_Core_Form $self
+ * @param array $errors
*/
public static function validateRecurContribution($fields, $files, $self, &$errors) {
if (!empty($fields['is_recur'])) {
/**
* Get child contact tags given parentId.
+ *
+ * @param int $parentId
+ * @param int $entityId
+ * @param string $entityTable
+ *
+ * @return array
*/
public static function getChildEntityTags($parentId, $entityId, $entityTable = 'civicrm_contact') {
$entityTags = array();
/**
* Merge two tags: tag B into tag A.
+ *
+ * @param int $tagAId
+ * @param int $tagBId
+ *
+ * @return array
*/
public function mergeTags($tagAId, $tagBId) {
$queryParams = array(
* @param array $nodes
* Each key is a numeral; each value is a node in
* the menu tree (with keys "child" and "attributes").
+ * @param int $maxNavID
+ * @param int $parentID
*/
private static function _fixNavigationMenu(&$nodes, &$maxNavID, $parentID) {
$origKeys = array_keys($nodes);
/**
* Call common delete function.
+ *
+ * @param int $id
+ *
+ * @return bool
*/
public static function del($id) {
// Ensure mysql phone function exists
}
/**
- * Validate & convert settings input - translate True False to 0 or 1
+ * Validate & convert settings input - translate True False to 0 or 1.
*
- * @value mixed value of the setting to be set
- * @fieldSpec array Metadata for given field (drawn from the xml)
+ * @param mixed $value value of the setting to be set
+ * @param array $fieldSpec Metadata for given field (drawn from the xml)
+ *
+ * @return bool
+ * @throws \api_Exception
*/
public static function validateBoolSetting(&$value, $fieldSpec) {
if (!CRM_Utils_Rule::boolean($value)) {
/**
* Find out whether given profile group using Activity
* Profile fields with contact fields
+ *
+ * @param int $ufGroupId
+ *
+ * @return bool
*/
public static function checkContactActivityProfileType($ufGroupId) {
$ufGroup = new CRM_Core_DAO_UFGroup();
/**
* Sets the size property of a textfield.
+ *
+ * @param string $fieldXML
+ *
+ * @return null|string
*/
protected function getSize($fieldXML) {
// Extract from <size> tag if supplied
/**
* Get components info from info file.
+ *
+ * @param string $crmFolderDir
+ *
+ * @return array
*/
public static function getComponentsFromFile($crmFolderDir) {
$components = array();
/**
* Builds advanced search form's component specific pane.
+ *
+ * @param CRM_Core_Form $form
*/
public function buildAdvancedSearchPaneForm(&$form) {
$bao = $this->getBAOQueryObject();
/**
* Do general cleanup of caches, temp directories and temp tables
* CRM-8739
+ *
+ * @param bool $sessionReset
*/
public function cleanupCaches($sessionReset = TRUE) {
// cleanup templates_c directory
/**
* @deprecated
+ *
+ * @param string $defaultCurrency
+ *
+ * @return string
*/
public function defaultCurrencySymbol($defaultCurrency = NULL) {
return CRM_Core_BAO_Country::defaultCurrencySymbol($defaultCurrency);
}
/**
+ * Save DAO object.
+ *
+ * @param bool $hook
+ *
* @return $this
*/
public function save($hook = TRUE) {
* Also, if we do not return any value the PEAR_ErrorStack::push() then does the
* action of PEAR_ERRORSTACK_PUSHANDLOG which displays the errors on the screen,
* since the logger set for this error stack is 'display' - see CRM_Core_Config::getLog();
+ *
+ * @param mixed $pearError
+ *
+ * @return int
*/
public static function handlePES($pearError) {
return PEAR_ERRORSTACK_PUSH;
/**
* Display the error message on terminal.
*
- * @param $message
+ * @param string $message
* @param bool $out
* Should we log or return the output.
*
* @param string $comp
* Message to be output.
- * @return string
- * format of the backtrace
- *
+ * @param string $priority
*
+ * @return string
+ * Format of the backtrace
*/
public static function debug_log_message($message, $out = FALSE, $comp = '', $priority = NULL) {
$config = CRM_Core_Config::singleton();
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Core_IDS {
private $init = NULL;
/**
+ * Check function.
+ *
* This function includes the IDS vendor parts and runs the
* detection routines on the request array.
*
return NULL;
}
- #add request url and user agent
+ // Add request url and user agent.
$_REQUEST['IDS_request_uri'] = $_SERVER['REQUEST_URI'];
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$_REQUEST['IDS_user_agent'] = $_SERVER['HTTP_USER_AGENT'];
}
/**
- * This function rects on the values in
- * the incoming results array.
+ * This function reacts on the values in the incoming results array.
*
* Depending on the impact value certain actions are
* performed.
}
/**
- * This function writes an entry about the intrusion
- * to the intrusion database
+ * This function writes an entry about the intrusion to the database.
*
* @param array $result
* @param int $reaction
}
/**
- * //todo
+ * Warn about IDS.
+ *
+ * @param array $result
+ *
+ * @return array
*/
private function warn($result) {
return $result;
}
/**
- * //todo
+ * Kick (whatever that means!).
+ *
+ * @param array $result
+ *
+ * @throws \Exception
*/
private function kick($result) {
$session = CRM_Core_Session::singleton();
* 2. Compute local tasks value if any
* 3. Propagate access argument, access callback, page callback to the menu item
* 4. Build the global navigation block
+ *
+ * @param array $menu
*/
public static function build(&$menu) {
foreach ($menu as $path => $menuItems) {
/**
* Produces error message and returns from class.
+ *
+ * @param int $errorCode
+ * @param string $errorMessage
+ *
+ * @return object
*/
public function &errorExit($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
/**
* Converts the comma separated name-value pairs in <merchant-private-data>
* to an array of name-value pairs.
+ *
+ * @param string $str
+ *
+ * @return array
*/
public static function stringToArray($str) {
$vars = $labels = array();
}
/**
- * Converts the comma separated name-value pairs in <TxnData2>
- * to an array of values.
+ * Converts the comma separated name-value pairs in <TxnData2> to an array of values.
+ *
+ * @param string $str
+ *
+ * @return array
*/
public static function stringToArray($str) {
$vars = $labels = array();
}
/**
- * Format the params from the form ready for sending to Realex. Also perform some validation
+ * Format the params from the form ready for sending to Realex.
+ *
+ * Also perform some validation
+ *
+ * @param array $params
+ *
+ * @return bool
*/
public function setRealexFields(&$params) {
if ((int) $params['amount'] <= 0) {
}
/**
- * ************************************************
- * Produces error message and returns from class
- * *************************************************
+ * Produces error message and returns from class.
+ *
+ * @param int $errorCode
+ * @param string $errorMessage
+ *
+ * @return object
*/
public function &errorExit($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
/**
* Take a single-value column (eg: a Radio or Select etc ) and convert
* value to the multi listed value (eg:"^Foo^")
+ *
+ * @param string $table
+ * @param string $column
*/
public function firstValueToFlatten($table, $column) {
$selectSql = "SELECT id, $column FROM $table WHERE $column IS NOT NULL";
/**
* Take a multi-value column (e.g. a Multi-Select or CheckBox column), and convert
* all values (of the form "^^" or "^Foo^" or "^Foo^Bar^") to the first listed value ("Foo")
+ *
+ * @param string $table
+ * @param string $column
*/
public function flattenToFirstValue($table, $column) {
$selectSql = "SELECT id, $column FROM $table WHERE $column IS NOT NULL";
* default is to always check permissioning but public pages for example might not want
* permission to be checked for anonymous users. Refer CRM-6211. We might be beaking
* Multi-Site dedupe for public pages.
+ *
+ * @param bool $checkPermission
+ *
+ * @return string
*/
public function thresholdQuery($checkPermission = TRUE) {
$this->_aclFrom = '';
* This is sometimes called in a loop (during event search).
*
* We cache the values to prevent repeated calls to the db.
+ *
+ * @param int $id
+ *
+ * @return
*/
public static function isMonetary($id) {
static $isMonetary = array();
}
/**
- * This is supposed to be overrided.
+ * This is supposed to be overridden.
+ *
+ * @param array $participant
*/
public function generateLabel($participant) {
$txt = "{$this->event['title']}
* @param string $nextType
* @param string $backType
*
- * @return void
+ * @param bool $submitOnce
*/
public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
/**
* Return custom data tables for specified entity / extends.
+ *
+ * @param string $extends
+ *
+ * @return array
*/
public function entityCustomDataLogTables($extends) {
$customGroupTables = array();
/**
* Get an array of column names of the given table.
+ *
+ * @param string$table
+ * @param bool $force
+ *
+ * @return array
*/
private function columnsOf($table, $force = FALSE) {
static $columnsOf = array();
/**
* Get an array of columns and their details like DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT for the given table.
+ *
+ * @param string $table
+ *
+ * @return array
*/
private function columnSpecsOf($table) {
static $columnSpecs = array(), $civiDB = NULL;
/**
* Create a log table with schema mirroring the given table’s structure and seeding it with the given table’s contents.
+ *
+ * @param string $table
*/
private function createLogTableFor($table) {
$dao = CRM_Core_DAO::executeQuery("SHOW CREATE TABLE $table", CRM_Core_DAO::$_nullArray, TRUE, NULL, FALSE, FALSE);
/**
* Returns total number of rows for the query.
*
- * @param
+ * @param int $action.
*
* @return int
* Total number of rows
/**
* This includes any extra fields that might need for export etc.
+ *
+ * @param string $mode
+ *
+ * @return array|null
*/
public static function extraReturnProperties($mode) {
$properties = NULL;
/**
* Build line items array.
+ *
* @param array $params
* Form values.
*
* @param string $entityTable
* Entity Table.
*
- * @return void
+ * @param bool $isRelatedID
*/
public static function getLineItemArray(&$params, $entityId = NULL, $entityTable = 'contribution', $isRelatedID = FALSE) {
* @param string $output
* What should the result set include (web/email/csv).
*
+ * @param string $extraWhereClause
+ *
* @return int
* the total number of rows for this action
*/
}
/**
- * set the _multiRecordTableName to display the result set.
- * according to multi record custom field values
+ * Set the _multiRecordTableName to display the result set.
+ *
+ * (according to multi record custom field values).
+ *
+ * @param array $fields
*/
public function setMultiRecordTableName($fields) {
$customGroupId = $multiRecordTableName = NULL;
$this->_multiRecordTableName
= $multiRecordTableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'table_name');
if ($multiRecordTableName) {
- return NULL;
+ return;
}
}
}
if (!isset($customGroupId) || !$customGroupId) {
- return NULL;
+ return;
}
//if the field is in selector and not a searchable field
/**
* Utility function for export2csv and CRM_Report_Form::endPostProcess
* - make CSV file content and return as string.
+ *
+ * @param CRM_Core_Form $form
+ * @param array $rows
+ *
+ * @return string
*/
public static function makeCsv(&$form, &$rows) {
$config = CRM_Core_Config::singleton();
* (Queue Task Callback)
*
* Upgrade code to create priceset for contribution pages and events
+ *
+ * @param \CRM_Queue_TaskContext $ctx
+ * @param string $rev
+ *
+ * @return bool
*/
public static function task_4_2_alpha1_createPriceSets(CRM_Queue_TaskContext $ctx, $rev) {
$upgrade = new CRM_Upgrade_Form();
}
/**
+ * Create price sets.
*
- * create price sets
+ * @param string $daoName
+ * @param string $addTo
+ * @param array $options
*/
public static function createPriceSet($daoName, $addTo, $options = array()) {
$query = "SELECT title FROM {$addTo[0]} where id =%1";
* (Queue Task Callback)
*
* Create an event registration profile with a single email field CRM-9587
+ *
+ * @param \CRM_Queue_TaskContext $ctx
+ *
+ * @return bool
*/
public static function task_4_2_alpha1_eventProfile(CRM_Queue_TaskContext $ctx) {
$upgrade = new CRM_Upgrade_Form();
/**
* returns the list of fields that can be imported.
*
+ * @param bool $prefix
+ *
* @return array
*/
static function &import($prefix = FALSE) {
}
/**
- * returns the list of fields that can be exported.
+ * Returns the list of fields that can be exported.
+ *
+ * @param bool $prefix
*
* @return array
*/
/**
* returns the list of fields that can be imported.
*
+ * @param bool $prefix
+ *
* @return array
*/
static function &import($prefix = FALSE) {
}
/**
- * returns the list of fields that can be exported.
+ * Returns the list of fields that can be exported.
+ *
+ * @param bool $prefix
*
* @return array
*/
}
/**
- * returns the list of fields that can be imported.
+ * Returns the list of fields that can be imported.
+ *
+ * @param bool $prefix
*
* @return array
*/
}
/**
- * returns the list of fields that can be imported.
+ * Returns the list of fields that can be imported.
+ *
+ * @param bool $prefix
*
* @return array
*/
/**
* Evaluate if a system check should be hushed/snoozed.
*
+ * @param string $message
+ *
* @return bool
* TRUE means hush/snooze, FALSE means display.
+ * @throws \CiviCRM_API3_Exception
*/
public static function checkHushSnooze($message) {
$statusPreferenceParams = array(
}
/**
- * check duplicate contacts based on de-deupe parameters
+ * Check duplicate contacts based on de-dupe parameters.
+ *
+ * @param array $params
+ *
+ * @return array
*/
function _civicrm_api3_deprecated_check_contact_dedupe($params) {
static $cIndieFields = NULL;
*/
public static function addTrailingSlash($path, $slash = NULL) {
if (!$slash) {
- // FIXME: Defaulting to backslash on windows systems can produce
+ // 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;
}
/**
- * Remove the 32 bit md5 we add to the fileName
- * also remove the unknown tag if we added it
+ * Remove the 32 bit md5 we add to the fileName also remove the unknown tag if we added it.
+ *
+ * @param $name
+ *
+ * @return mixed
*/
public static function cleanFileName($name) {
// replace the last 33 character before the '.' with null
/**
* Determine if a path is absolute.
*
+ * @param string $path
+ *
* @return bool
* TRUE if absolute. FALSE if relative.
*/
/**
* Retrieve a contact ID and if not present.
- * create one with this email
+ *
+ * Create one with this email
+ *
+ * @param string $email
+ * @param string $name
+ * @param bool $create
+ * @param string $mail
+ *
+ * @return int|null
*/
public static function getContactID($email, $name = NULL, $create = TRUE, &$mail) {
$dao = CRM_Contact_BAO_Contact::matchContactOnEmail($email, 'Individual');
* See how file rules are written in HTML/QuickForm/file.php
* Checks to make sure the uploaded file is ascii
*
+ * @param string $elementValue
+ *
* @return bool
- * true if file has been uploaded, false otherwise
+ * True if file has been uploaded, false otherwise
*/
public static function asciiFile($elementValue) {
if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
/**
* Checks to make sure the uploaded file is in UTF-8, recodes if it's not
*
+ * @param array $elementValue
+ *
* @return bool
- * whether file has been uploaded properly and is now in UTF-8
+ * Whether file has been uploaded properly and is now in UTF-8.
*/
public static function utf8File($elementValue) {
$success = FALSE;
* See how file rules are written in HTML/QuickForm/file.php
* Checks to make sure the uploaded file is html
*
+ * @param array $elementValue
+ *
* @return bool
- * true if file has been uploaded, false otherwise
+ * True if file has been uploaded, false otherwise
*/
public static function htmlFile($elementValue) {
if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
}
/**
+ * Get CMS root path.
+ *
+ * @param string $scriptFilename
+ *
+ * @return null|string
*/
public function cmsRootPath($scriptFilename = NULL) {
$cmsRoot = $valid = NULL;
}
/**
+ * Get CMS root path.
+ *
+ * @param string $scriptFilename
+ *
+ * @return null|string
*/
public function cmsRootPath($scriptFilename = NULL) {
$cmsRoot = $valid = NULL;
/**
* Append Drupal js to coreResourcesList.
+ *
+ * @param array $list
*/
public function appendCoreResources(&$list) {
$list[] = 'js/crm.drupal.js';
/**
* FIXME: Do something
+ *
+ * @param string $message
*/
public function setMessage($message) {
}
/**
* FIXME: Do something
+ *
+ * @param \obj $user
+ *
+ * @return bool
*/
public function loadUser($user) {
return TRUE;
/**
* FIXME: Do something
+ *
+ * @param string $message
*/
public function setMessage($message) {
}
/**
* FIXME: Do something
+ *
+ * @param \obj $user
+ *
+ * @return bool
*/
public function loadUser($user) {
return TRUE;
}
/**
- * Delete a CiviCRM UF_Join
+ * Delete a CiviCRM UF_Join.
*
* @param array $params
* Array of name/value pairs.
+ *
+ * @return array
+ * API result array.
*/
function civicrm_api3_uf_join_delete($params) {
return _civicrm_api3_basic_delete('CRM_Core_BAO_UFJoin', $params);
* Execute the default schedule, without any special recipient selections.
*
* @dataProvider createTestCases
+ *
+ * @param string $targetDate
+ * @param string $setupFuncs
+ * @param array $expectMessages
+ *
+ * @throws \Exception
*/
public function testDefault($targetDate, $setupFuncs, $expectMessages) {
$this->targetDate = $targetDate;
/**
* Type and select first occurrence of autocomplete.
+ *
* @param $fieldName
- * @param $label
+ * @param string $labels
* @param bool $multiple
* @param bool $xpath
*/
* $this->createLoggedInUser();
* $this->_permissionedDisabledGroup = $this->groupCreate(array('title' => 'pick-me-disabled', 'is_active' => 0, 'name' => 'pick-me-disabled'));
* $this->_permissionedGroup = $this->groupCreate(array('title' => 'pick-me-active', 'is_active' => 1, 'name' => 'pick-me-active'));
+ *
+ * @param bool $isProfile
*/
public function setupACL($isProfile = FALSE) {
global $_REQUEST;
}
/**
- * @param $status
+ * Test enabling participant statuses.
+ *
+ * @param int $statusId
*/
public function _testEnableParticipantStatuses($statusId) {
// enable participant status
}
/**
+ * Test online membership signup.
+ *
* @param int $pageId
* @param int $memTypeId
* @param string $firstName
* @param string $lastName
- * @param $payLater
- * @param $hash
+ * @param bool $payLater
+ * @param string $hash
* @param bool $otherAmount
+ * @param bool $amountSection
+ * @param bool $freeMembership
*/
public function _testOnlineMembershipSignup($pageId, $memTypeId, $firstName, $lastName, $payLater, $hash, $otherAmount = FALSE, $amountSection = TRUE, $freeMembership = FALSE) {
//Open Live Contribution Page