X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FFriend%2FForm.php;h=4509acd993377f7c524565a73b6d7279d99d51d2;hb=570efea9f5b0b6ce4f2ba07ce29674b76541bf84;hp=56753c967789f78f8b1f43544fbecc46c71757b2;hpb=8b9a8f4abb25cfa7a498eaaa3e459e4d313e350a;p=civicrm-core.git diff --git a/CRM/Friend/Form.php b/CRM/Friend/Form.php index 56753c9677..4509acd993 100644 --- a/CRM/Friend/Form.php +++ b/CRM/Friend/Form.php @@ -80,14 +80,14 @@ class CRM_Friend_Form extends CRM_Core_Form { $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); @@ -106,10 +106,10 @@ class CRM_Friend_Form extends CRM_Core_Form { 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'])) { @@ -125,11 +125,10 @@ class CRM_Friend_Form extends CRM_Core_Form { 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); @@ -160,7 +159,7 @@ class CRM_Friend_Form extends CRM_Core_Form { * @return void */ public function setDefaultValues() { - $defaults = array(); + $defaults = []; $defaults['entity_id'] = $this->_entityId; $defaults['entity_table'] = $this->_entityTable; @@ -205,7 +204,7 @@ class CRM_Friend_Form extends CRM_Core_Form { $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; @@ -218,21 +217,20 @@ class CRM_Friend_Form extends CRM_Core_Form { $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']); } /** @@ -245,7 +243,7 @@ class CRM_Friend_Form extends CRM_Core_Form { */ public static function formRule($fields) { - $errors = array(); + $errors = []; $valid = FALSE; foreach ($fields['friend'] as $key => $val) { @@ -293,7 +291,7 @@ class CRM_Friend_Form extends CRM_Core_Form { CRM_Friend_BAO_Friend::create($formValues); $this->assign('status', 'thankyou'); - $defaults = array(); + $defaults = []; $defaults['entity_id'] = $this->_entityId; $defaults['entity_table'] = $this->_entityTable;