$pcomponent = CRM_Utils_Request::retrieve('pcomponent', 'String', $this, TRUE);
- if (in_array($pcomponent, array(
+ if (in_array($pcomponent, [
'contribute',
'event',
- ))) {
- $values = array();
- $params = array('id' => $this->_entityId);
+ ])) {
+ $values = [];
+ $params = ['id' => $this->_entityId];
CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage',
- $params, $values, array('title', 'campaign_id', 'is_share')
+ $params, $values, ['title', 'campaign_id', 'is_share']
);
$this->_title = CRM_Utils_Array::value('title', $values);
$this->_campaignId = CRM_Utils_Array::value('campaign_id', $values);
elseif ($pcomponent == 'pcp') {
$this->_pcpBlockId = CRM_Utils_Request::retrieve('blockId', 'Positive', $this, TRUE);
- $values = array();
- $params = array('id' => $this->_pcpBlockId);
+ $values = [];
+ $params = ['id' => $this->_pcpBlockId];
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCPBlock',
- $params, $values, array('is_tellfriend_enabled', 'tellfriend_limit')
+ $params, $values, ['is_tellfriend_enabled', 'tellfriend_limit']
);
if (empty($values['is_tellfriend_enabled'])) {
FROM civicrm_pcp pcp
INNER JOIN civicrm_contribution_page contrib ON ( pcp.page_id = contrib.id AND pcp.page_type = "contribute" )
WHERE pcp.id = %1';
- $pcp = CRM_Core_DAO::executeQuery($sql, array(1 => array($this->_entityId, 'Positive')));
+ $pcp = CRM_Core_DAO::executeQuery($sql, [1 => [$this->_entityId, 'Positive']]);
while ($pcp->fetch()) {
$this->_title = $pcp->title;
$this->_campaignId = $pcp->campaign_id;
- $pcp->free();
}
$this->assign('pcpTitle', $this->_title);
* @return void
*/
public function setDefaultValues() {
- $defaults = array();
+ $defaults = [];
$defaults['entity_id'] = $this->_entityId;
$defaults['entity_table'] = $this->_entityTable;
$email->freeze();
$this->add('wysiwyg', 'suggested_message', ts('Your Message'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'suggested_message'));
- $friend = array();
+ $friend = [];
$mailLimit = self::NUM_OPTION;
if ($this->_entityTable == 'civicrm_pcp') {
$mailLimit = $this->_mailLimit;
$this->addRule("friend[$i][email]", ts('The format of this email address is not valid.'), 'email');
}
- $this->addButtons(array(
- array(
- 'type' => 'submit',
- 'name' => ts('Send Your Message'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- )
- );
-
- $this->addFormRule(array('CRM_Friend_Form', 'formRule'));
+ $this->addButtons([
+ [
+ 'type' => 'submit',
+ 'name' => ts('Send Your Message'),
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
+
+ $this->addFormRule(['CRM_Friend_Form', 'formRule']);
}
/**
*/
public static function formRule($fields) {
- $errors = array();
+ $errors = [];
$valid = FALSE;
foreach ($fields['friend'] as $key => $val) {
CRM_Friend_BAO_Friend::create($formValues);
$this->assign('status', 'thankyou');
- $defaults = array();
+ $defaults = [];
$defaults['entity_id'] = $this->_entityId;
$defaults['entity_table'] = $this->_entityTable;