From 7e8c8317659ef967202ba411a7020594301e0f23 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 10 Apr 2019 10:25:23 +1000 Subject: [PATCH] (NFC) Update CRM/Friend CRM/Grant CRM/Group CRM/Mailing to be up to date to a future coder version --- CRM/Friend/Form.php | 23 ++++---- CRM/Grant/BAO/Query.php | 1 + CRM/Grant/Form/Grant.php | 56 +++++++++--------- CRM/Grant/Form/GrantView.php | 15 +++-- CRM/Grant/Form/Search.php | 1 + CRM/Grant/Form/Task.php | 21 ++++--- CRM/Grant/Form/Task/Print.php | 23 ++++---- CRM/Grant/Form/Task/Result.php | 13 ++--- CRM/Grant/Form/Task/SearchTaskHookSample.php | 13 ++--- CRM/Grant/Info.php | 2 +- CRM/Grant/Page/Tab.php | 2 +- CRM/Grant/Selector/Search.php | 6 +- CRM/Grant/Task.php | 12 ++-- CRM/Group/Form/Edit.php | 42 +++++++------- CRM/Group/Page/AJAX.php | 1 + CRM/Mailing/BAO/BouncePattern.php | 3 +- CRM/Mailing/BAO/Mailing.php | 60 ++++++++++++-------- CRM/Mailing/BAO/MailingAB.php | 1 - CRM/Mailing/BAO/MailingJob.php | 11 ++-- CRM/Mailing/BAO/Query.php | 8 +-- CRM/Mailing/BAO/Spool.php | 9 ++- CRM/Mailing/Config.php | 3 +- CRM/Mailing/Event/BAO/Subscribe.php | 6 +- CRM/Mailing/Form/Browse.php | 21 ++++--- CRM/Mailing/Form/Component.php | 48 ++++++++-------- CRM/Mailing/Form/ForwardMailing.php | 13 +++-- CRM/Mailing/Form/Search.php | 7 +-- CRM/Mailing/Form/Subscribe.php | 21 ++++--- CRM/Mailing/Form/Task.php | 21 ++++--- CRM/Mailing/Form/Task/Print.php | 23 ++++---- CRM/Mailing/Info.php | 12 ++-- CRM/Mailing/MailStore.php | 15 +++-- CRM/Mailing/MailStore/Localdir.php | 20 +++---- CRM/Mailing/MailStore/Maildir.php | 26 ++++----- CRM/Mailing/MailStore/Mbox.php | 20 +++---- CRM/Mailing/MailStore/Pop3.php | 20 +++---- CRM/Mailing/Page/Component.php | 2 +- CRM/Mailing/Page/Confirm.php | 1 + CRM/Mailing/Page/Optout.php | 1 + CRM/Mailing/Page/Resubscribe.php | 1 + CRM/Mailing/Page/Tab.php | 2 +- CRM/Mailing/PseudoConstant.php | 5 +- CRM/Mailing/Selector/Browse.php | 4 +- CRM/Mailing/Selector/Event.php | 7 ++- CRM/Mailing/Selector/Search.php | 6 +- CRM/Mailing/Task.php | 2 +- 46 files changed, 325 insertions(+), 305 deletions(-) diff --git a/CRM/Friend/Form.php b/CRM/Friend/Form.php index d8d7263b61..70cd21086d 100644 --- a/CRM/Friend/Form.php +++ b/CRM/Friend/Form.php @@ -219,18 +219,17 @@ class CRM_Friend_Form extends CRM_Core_Form { } $this->addButtons([ - [ - 'type' => 'submit', - 'name' => ts('Send Your Message'), - 'spacing' => '         ', - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'submit', + 'name' => ts('Send Your Message'), + 'spacing' => '         ', + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); $this->addFormRule(['CRM_Friend_Form', 'formRule']); } diff --git a/CRM/Grant/BAO/Query.php b/CRM/Grant/BAO/Query.php index eae47c5b47..7e2f9d48fa 100644 --- a/CRM/Grant/BAO/Query.php +++ b/CRM/Grant/BAO/Query.php @@ -33,6 +33,7 @@ * */ class CRM_Grant_BAO_Query extends CRM_Core_BAO_Query { + /** * @return array */ diff --git a/CRM/Grant/Form/Grant.php b/CRM/Grant/Form/Grant.php index 9803669837..36d7afa24f 100644 --- a/CRM/Grant/Form/Grant.php +++ b/CRM/Grant/Form/Grant.php @@ -155,18 +155,17 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { if ($this->_action & CRM_Core_Action::DELETE) { $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Delete'), - 'spacing' => '         ', - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Delete'), + 'spacing' => '         ', + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); return; } @@ -208,23 +207,22 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { // make this form an upload since we dont know if the custom data injected dynamically // is of type file etc $uploadNames = $this->get( 'uploadNames' ); $this->addButtons([ - [ - 'type' => 'upload', - 'name' => ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'upload', - 'name' => ts('Save and New'), - 'js' => ['onclick' => "return verify( );"], - 'subName' => 'new', - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'upload', + 'name' => ts('Save'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'upload', + 'name' => ts('Save and New'), + 'js' => ['onclick' => "return verify( );"], + 'subName' => 'new', + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); if ($this->_context == 'standalone') { $this->addEntityRef('contact_id', ts('Applicant'), ['create' => TRUE], TRUE); diff --git a/CRM/Grant/Form/GrantView.php b/CRM/Grant/Form/GrantView.php index 8dbd187efb..1f55a08c89 100644 --- a/CRM/Grant/Form/GrantView.php +++ b/CRM/Grant/Form/GrantView.php @@ -132,14 +132,13 @@ class CRM_Grant_Form_GrantView extends CRM_Core_Form { */ public function buildQuickForm() { $this->addButtons([ - [ - 'type' => 'cancel', - 'name' => ts('Done'), - 'spacing' => '         ', - 'isDefault' => TRUE, - ], - ] - ); + [ + 'type' => 'cancel', + 'name' => ts('Done'), + 'spacing' => '         ', + 'isDefault' => TRUE, + ], + ]); } } diff --git a/CRM/Grant/Form/Search.php b/CRM/Grant/Form/Search.php index 5981f0d213..9cb7c8e397 100644 --- a/CRM/Grant/Form/Search.php +++ b/CRM/Grant/Form/Search.php @@ -59,6 +59,7 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { /** * Prefix for the controller. + * @var string */ protected $_prefix = "grant_"; diff --git a/CRM/Grant/Form/Task.php b/CRM/Grant/Form/Task.php index da5458e849..e868f4d646 100644 --- a/CRM/Grant/Form/Task.php +++ b/CRM/Grant/Form/Task.php @@ -138,17 +138,16 @@ class CRM_Grant_Form_Task extends CRM_Core_Form_Task { */ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) { $this->addButtons([ - [ - 'type' => $nextType, - 'name' => $title, - 'isDefault' => TRUE, - ], - [ - 'type' => $backType, - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => $nextType, + 'name' => $title, + 'isDefault' => TRUE, + ], + [ + 'type' => $backType, + 'name' => ts('Cancel'), + ], + ]); } } diff --git a/CRM/Grant/Form/Task/Print.php b/CRM/Grant/Form/Task/Print.php index 34d3f2b241..9f962f1294 100644 --- a/CRM/Grant/Form/Task/Print.php +++ b/CRM/Grant/Form/Task/Print.php @@ -78,18 +78,17 @@ class CRM_Grant_Form_Task_Print extends CRM_Grant_Form_Task { // just need to add a javacript to popup the window for printing // $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Print Grant List'), - 'js' => ['onclick' => 'window.print()'], - 'isDefault' => TRUE, - ], - [ - 'type' => 'back', - 'name' => ts('Done'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Print Grant List'), + 'js' => ['onclick' => 'window.print()'], + 'isDefault' => TRUE, + ], + [ + 'type' => 'back', + 'name' => ts('Done'), + ], + ]); } /** diff --git a/CRM/Grant/Form/Task/Result.php b/CRM/Grant/Form/Task/Result.php index 5c9f719c10..eb6086e47b 100644 --- a/CRM/Grant/Form/Task/Result.php +++ b/CRM/Grant/Form/Task/Result.php @@ -71,13 +71,12 @@ class CRM_Grant_Form_Task_Result extends CRM_Grant_Form_Task { */ public function buildQuickForm() { $this->addButtons([ - [ - 'type' => 'done', - 'name' => ts('Done'), - 'isDefault' => TRUE, - ], - ] - ); + [ + 'type' => 'done', + 'name' => ts('Done'), + 'isDefault' => TRUE, + ], + ]); } } diff --git a/CRM/Grant/Form/Task/SearchTaskHookSample.php b/CRM/Grant/Form/Task/SearchTaskHookSample.php index 8d448b8412..a09dfa6213 100644 --- a/CRM/Grant/Form/Task/SearchTaskHookSample.php +++ b/CRM/Grant/Form/Task/SearchTaskHookSample.php @@ -79,13 +79,12 @@ INNER JOIN civicrm_contact ct ON ( grt.contact_id = ct.id ) */ public function buildQuickForm() { $this->addButtons([ - [ - 'type' => 'done', - 'name' => ts('Done'), - 'isDefault' => TRUE, - ], - ] - ); + [ + 'type' => 'done', + 'name' => ts('Done'), + 'isDefault' => TRUE, + ], + ]); } } diff --git a/CRM/Grant/Info.php b/CRM/Grant/Info.php index b947cbd5c7..7ae2788d91 100644 --- a/CRM/Grant/Info.php +++ b/CRM/Grant/Info.php @@ -38,6 +38,7 @@ class CRM_Grant_Info extends CRM_Core_Component_Info { /** + * @var string * @inheritDoc */ protected $keyword = 'grant'; @@ -57,7 +58,6 @@ class CRM_Grant_Info extends CRM_Core_Component_Info { ]; } - /** * @inheritDoc * @param bool $getAllUnconditionally diff --git a/CRM/Grant/Page/Tab.php b/CRM/Grant/Page/Tab.php index 7e86083c37..914879716c 100644 --- a/CRM/Grant/Page/Tab.php +++ b/CRM/Grant/Page/Tab.php @@ -44,7 +44,7 @@ class CRM_Grant_Page_Tab extends CRM_Contact_Page_View { * * @var array */ - static $_links = NULL; + public static $_links = NULL; public $_permission = NULL; public $_contactId = NULL; diff --git a/CRM/Grant/Selector/Search.php b/CRM/Grant/Selector/Search.php index 561261cd09..19ff51cd4f 100644 --- a/CRM/Grant/Selector/Search.php +++ b/CRM/Grant/Selector/Search.php @@ -46,20 +46,20 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co * * @var array */ - static $_links = NULL; + public static $_links = NULL; /** * We use desc to remind us what that column is, name is used in the tpl * * @var array */ - static $_columnHeaders; + public static $_columnHeaders; /** * Properties of contact we're interested in displaying * @var array */ - static $_properties = [ + public static $_properties = [ 'contact_id', 'contact_type', 'sort_name', diff --git a/CRM/Grant/Task.php b/CRM/Grant/Task.php index e9a14e59c8..467853f627 100644 --- a/CRM/Grant/Task.php +++ b/CRM/Grant/Task.php @@ -40,11 +40,15 @@ */ class CRM_Grant_Task extends CRM_Core_Task { - const - // Grant Tasks - UPDATE_GRANTS = 701; + /** + * Grant Tasks + */ + const UPDATE_GRANTS = 701; - static $objectType = 'grant'; + /** + * @var string + */ + public static $objectType = 'grant'; /** * These tasks are the core set of tasks that the user can perform diff --git a/CRM/Group/Form/Edit.php b/CRM/Group/Form/Edit.php index a745b401e1..789689886f 100644 --- a/CRM/Group/Form/Edit.php +++ b/CRM/Group/Form/Edit.php @@ -215,17 +215,16 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { public function buildQuickForm() { if ($this->_action == CRM_Core_Action::DELETE) { $this->addButtons(array( - array( - 'type' => 'next', - 'name' => ts('Delete Group'), - 'isDefault' => TRUE, - ), - array( - 'type' => 'cancel', - 'name' => ts('Cancel'), - ), - ) - ); + array( + 'type' => 'next', + 'name' => ts('Delete Group'), + 'isDefault' => TRUE, + ), + array( + 'type' => 'cancel', + 'name' => ts('Cancel'), + ), + )); return; } @@ -274,17 +273,16 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { CRM_Custom_Form_CustomData::buildQuickForm($this); $this->addButtons(array( - array( - 'type' => 'upload', - 'name' => ($this->_action == CRM_Core_Action::ADD) ? ts('Continue') : ts('Save'), - 'isDefault' => TRUE, - ), - array( - 'type' => 'cancel', - 'name' => ts('Cancel'), - ), - ) - ); + array( + 'type' => 'upload', + 'name' => ($this->_action == CRM_Core_Action::ADD) ? ts('Continue') : ts('Save'), + 'isDefault' => TRUE, + ), + array( + 'type' => 'cancel', + 'name' => ts('Cancel'), + ), + )); $doParentCheck = FALSE; if (CRM_Core_Permission::isMultisiteEnabled()) { diff --git a/CRM/Group/Page/AJAX.php b/CRM/Group/Page/AJAX.php index f1bf656f61..5ccad88a88 100644 --- a/CRM/Group/Page/AJAX.php +++ b/CRM/Group/Page/AJAX.php @@ -36,6 +36,7 @@ * This class contains the functions that are called using AJAX (jQuery) */ class CRM_Group_Page_AJAX { + /** * Get list of groups. */ diff --git a/CRM/Mailing/BAO/BouncePattern.php b/CRM/Mailing/BAO/BouncePattern.php index 5a255b5c11..d3bc49fd6f 100644 --- a/CRM/Mailing/BAO/BouncePattern.php +++ b/CRM/Mailing/BAO/BouncePattern.php @@ -34,8 +34,9 @@ class CRM_Mailing_BAO_BouncePattern extends CRM_Mailing_DAO_BouncePattern { /** * Pseudo-constant pattern array. + * @var array */ - static $_patterns = NULL; + public static $_patterns = NULL; /** * Class constructor. diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index a6e37494c4..7177149ea4 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -41,6 +41,7 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing { * An array that holds the complete templates * including any headers or footers that need to be prepended * or appended to the body. + * @var array */ private $preparedTemplates = NULL; @@ -48,41 +49,49 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing { * An array that holds the complete templates * including any headers or footers that need to be prepended * or appended to the body. + * @var array */ private $templates = NULL; /** * An array that holds the tokens that are specifically found in our text and html bodies. + * @var array */ private $tokens = NULL; /** * An array that holds the tokens that are specifically found in our text and html bodies. + * @var array */ private $flattenedTokens = NULL; /** * The header associated with this mailing. + * @var string */ private $header = NULL; /** * The footer associated with this mailing. + * @var string */ private $footer = NULL; /** * The HTML content of the message. + * @var string */ private $html = NULL; /** * The text content of the message. + * @var string */ private $text = NULL; /** * Cached BAO for the domain. + * @var int */ private $_domain = NULL; @@ -607,10 +616,10 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing { $this->preparedTemplates = []; foreach ([ - 'html', - 'text', - 'subject', - ] as $key) { + 'html', + 'text', + 'subject', + ] as $key) { if (!isset($templates[$key])) { continue; } @@ -809,14 +818,13 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing { public function getTestRecipients($testParams) { if (!empty($testParams['test_group']) && array_key_exists($testParams['test_group'], CRM_Core_PseudoConstant::group())) { $contacts = civicrm_api('contact', 'get', [ - 'version' => 3, - 'group' => $testParams['test_group'], - 'return' => 'id', - 'options' => [ - 'limit' => 100000000000, - ], - ] - ); + 'version' => 3, + 'group' => $testParams['test_group'], + 'return' => 'id', + 'options' => [ + 'limit' => 100000000000, + ], + ]); foreach (array_keys($contacts['values']) as $groupContact) { $query = " @@ -1742,7 +1750,7 @@ ORDER BY civicrm_email.is_bulkmail DESC * 'include' or 'exclude'. * @param string $entity * 'groups' or 'mailings'. - * @param array $entityIds + * @param array $entityIds * @throws CiviCRM_API3_Exception */ public static function replaceGroups($mailingId, $type, $entity, $entityIds) { @@ -2176,7 +2184,8 @@ ORDER BY civicrm_email.is_bulkmail DESC break; case 'opened': - $reportFilter .= "&distinct=0"; // do not use group by clause in report, because same report used for total and unique open + // do not use group by clause in report, because same report used for total and unique open + $reportFilter .= "&distinct=0"; case 'opened_unique': $url = "mailing/opened"; $searchFilter .= "&mailing_open_status=Y"; @@ -2957,7 +2966,7 @@ ORDER BY civicrm_mailing.name"; * Array of mailings for a contact * */ - static public function getContactMailings(&$params) { + public static function getContactMailings(&$params) { $params['version'] = 3; $params['offset'] = ($params['page'] - 1) * $params['rp']; $params['limit'] = $params['rp']; @@ -2976,7 +2985,7 @@ ORDER BY civicrm_mailing.name"; * count of mailings for a contact * */ - static public function getContactMailingsCount(&$params) { + public static function getContactMailingsCount(&$params) { $params['version'] = 3; return civicrm_api('MailingContact', 'getcount', $params); } @@ -2994,17 +3003,18 @@ ORDER BY civicrm_mailing.name"; foreach ($fieldNames as $fieldName) { if ($fieldName == 'id') { $fieldPerms[$fieldName] = [ + // OR [ 'access CiviMail', 'schedule mailings', 'approve mailings', - 'create mailings', - ], // OR + ], ]; } elseif (in_array($fieldName, ['scheduled_date', 'scheduled_id'])) { $fieldPerms[$fieldName] = [ - ['access CiviMail', 'schedule mailings'], // OR + // OR + ['access CiviMail', 'schedule mailings'], ]; } elseif (in_array($fieldName, [ @@ -3014,12 +3024,14 @@ ORDER BY civicrm_mailing.name"; 'approval_note', ])) { $fieldPerms[$fieldName] = [ - ['access CiviMail', 'approve mailings'], // OR + // OR + ['access CiviMail', 'approve mailings'], ]; } else { $fieldPerms[$fieldName] = [ - ['access CiviMail', 'create mailings'], // OR + // OR + ['access CiviMail', 'create mailings'], ]; } } @@ -3048,9 +3060,9 @@ ORDER BY civicrm_mailing.name"; */ public static function getPublicViewUrl($id, $absolute = TRUE) { if ((civicrm_api3('Mailing', 'getvalue', [ - 'id' => $id, - 'return' => 'visibility', - ])) === 'Public Pages') { + 'id' => $id, + 'return' => 'visibility', + ])) === 'Public Pages') { return CRM_Utils_System::url('civicrm/mailing/view', ['id' => $id], $absolute, NULL, TRUE, TRUE); } } diff --git a/CRM/Mailing/BAO/MailingAB.php b/CRM/Mailing/BAO/MailingAB.php index e2ff2fbdbb..2ff81ed5e9 100644 --- a/CRM/Mailing/BAO/MailingAB.php +++ b/CRM/Mailing/BAO/MailingAB.php @@ -109,7 +109,6 @@ class CRM_Mailing_BAO_MailingAB extends CRM_Mailing_DAO_MailingAB { return $result; } - /** * Delete MailingAB and all its associated records. * diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index c74785568e..8f3dff95e2 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -45,7 +45,7 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob { * * @var int */ - static $mailsProcessed = 0; + public static $mailsProcessed = 0; /** * Class constructor. @@ -62,7 +62,7 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob { * @return \CRM_Mailing_BAO_MailingJob * @throws \CRM_Core_Exception */ - static public function create($params) { + public static function create($params) { if (empty($params['id']) && empty($params['mailing_id'])) { throw new CRM_Core_Exception("Failed to create job: Unknown mailing ID"); } @@ -301,7 +301,6 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob { } } - /** * before we run jobs, we need to split the jobs * @param int $offset @@ -602,9 +601,11 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) // CRM-15702: Sending bulk sms to contacts without e-mail address fails. // Solution is to skip checking for on hold - $skipOnHold = TRUE; //do include a statement to check wether e-mail address is on hold + //do include a statement to check wether e-mail address is on hold + $skipOnHold = TRUE; if ($mailing->sms_provider_id) { - $skipOnHold = FALSE; //do not include a statement to check wether e-mail address is on hold + //do not include a statement to check wether e-mail address is on hold + $skipOnHold = FALSE; } foreach ($fields as $key => $field) { diff --git a/CRM/Mailing/BAO/Query.php b/CRM/Mailing/BAO/Query.php index 329d9b7932..ff1e5a8dd0 100644 --- a/CRM/Mailing/BAO/Query.php +++ b/CRM/Mailing/BAO/Query.php @@ -32,7 +32,7 @@ */ class CRM_Mailing_BAO_Query { - static $_mailingFields = NULL; + public static $_mailingFields = NULL; /** * @return array|null @@ -313,9 +313,9 @@ class CRM_Mailing_BAO_Query { 'bounce_type_id', ts('Bounce type(s)'), CRM_Core_PseudoConstant::get('CRM_Mailing_Event_DAO_Bounce', 'bounce_type_id', [ - 'keyColumn' => 'id', - 'labelColumn' => 'name', - ]) + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ]) ); return; diff --git a/CRM/Mailing/BAO/Spool.php b/CRM/Mailing/BAO/Spool.php index 26eb8d3ea3..ffb5e51c06 100644 --- a/CRM/Mailing/BAO/Spool.php +++ b/CRM/Mailing/BAO/Spool.php @@ -88,14 +88,16 @@ class CRM_Mailing_BAO_Spool extends CRM_Mailing_DAO_Spool { } $job = new CRM_Mailing_BAO_MailingJob(); - $job->is_test = 0; // if set to 1 it doesn't show in the UI + // if set to 1 it doesn't show in the UI + $job->is_test = 0; $job->status = 'Complete'; $job->scheduled_date = CRM_Utils_Date::processDate(date('Y-m-d'), date('H:i:s')); $job->start_date = $job->scheduled_date; $job->end_date = $job->scheduled_date; $job->mailing_id = $mailing->id; $job->save(); - $job_id = $job->id; // need this for parent_id below + // need this for parent_id below + $job_id = $job->id; $job = new CRM_Mailing_BAO_MailingJob(); $job->is_test = 0; @@ -107,7 +109,8 @@ class CRM_Mailing_BAO_Spool extends CRM_Mailing_DAO_Spool { $job->parent_id = $job_id; $job->job_type = 'child'; $job->save(); - $job_id = $job->id; // this is the one we want for the spool + // this is the one we want for the spool + $job_id = $job->id; if (is_array($recipient)) { $recipient = implode(';', $recipient); diff --git a/CRM/Mailing/Config.php b/CRM/Mailing/Config.php index 94064c2bb0..79fdb2028e 100644 --- a/CRM/Mailing/Config.php +++ b/CRM/Mailing/Config.php @@ -36,7 +36,8 @@ class CRM_Mailing_Config { const OUTBOUND_OPTION_SENDMAIL = 1; const OUTBOUND_OPTION_DISABLED = 2; const OUTBOUND_OPTION_MAIL = 3; - const OUTBOUND_OPTION_MOCK = 4; // seems to be the same as 2, but also calls Mail's pre/post hooks? - see packages/Mail + // seems to be the same as 2, but also calls Mail's pre/post hooks? - see packages/Mail + const OUTBOUND_OPTION_MOCK = 4; const OUTBOUND_OPTION_REDIRECT_TO_DB = 5; // special value for mail bulk inserts to avoid diff --git a/CRM/Mailing/Event/BAO/Subscribe.php b/CRM/Mailing/Event/BAO/Subscribe.php index 2df4893a8f..b020f76ad7 100644 --- a/CRM/Mailing/Event/BAO/Subscribe.php +++ b/CRM/Mailing/Event/BAO/Subscribe.php @@ -371,9 +371,9 @@ SELECT civicrm_email.id as email_id $group[$groupID]['status'] = $contactGroups[$groupID]['status']; $status = ts('You are already subscribed in %1, your subscription is %2.', [ - 1 => $group[$groupID]['title'], - 2 => ts($group[$groupID]['status']), - ]); + 1 => $group[$groupID]['title'], + 2 => ts($group[$groupID]['status']), + ]); CRM_Utils_System::setUFMessage($status); continue; } diff --git a/CRM/Mailing/Form/Browse.php b/CRM/Mailing/Form/Browse.php index d0c1f8d9c8..bb52d77a1f 100644 --- a/CRM/Mailing/Form/Browse.php +++ b/CRM/Mailing/Form/Browse.php @@ -63,17 +63,16 @@ class CRM_Mailing_Form_Browse extends CRM_Core_Form { */ public function buildQuickForm() { $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Confirm'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Confirm'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); } public function postProcess() { diff --git a/CRM/Mailing/Form/Component.php b/CRM/Mailing/Form/Component.php index beb2efee21..2200d9a5a3 100644 --- a/CRM/Mailing/Form/Component.php +++ b/CRM/Mailing/Form/Component.php @@ -65,9 +65,9 @@ class CRM_Mailing_Form_Component extends CRM_Core_Form { CRM_Core_DAO::getAttribute('CRM_Mailing_BAO_MailingComponent', 'name'), TRUE ); $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [ - 'CRM_Mailing_BAO_MailingComponent', - $this->_id, - ]); + 'CRM_Mailing_BAO_MailingComponent', + $this->_id, + ]); $this->add('select', 'component_type', ts('Component Type'), CRM_Core_SelectValues::mailingComponents()); @@ -89,17 +89,16 @@ class CRM_Mailing_Form_Component extends CRM_Core_Form { $this->addFormRule(['CRM_Mailing_Form_Component', 'dataRule']); $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Save'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); } /** @@ -134,9 +133,8 @@ class CRM_Mailing_Form_Component extends CRM_Core_Form { $component = CRM_Mailing_BAO_MailingComponent::add($params); CRM_Core_Session::setStatus(ts('The mailing component \'%1\' has been saved.', [ - 1 => $component->name, - ] - ), ts('Saved'), 'success'); + 1 => $component->name, + ]), ts('Saved'), 'success'); } @@ -161,24 +159,24 @@ class CRM_Mailing_Form_Component extends CRM_Core_Form { } $errors = []; foreach ([ - 'text', - 'html', - ] as $type) { + 'text', + 'html', + ] as $type) { $dataErrors = []; foreach ($InvalidTokens as $token => $desc) { if ($params['body_' . $type]) { if (preg_match('/' . preg_quote('{' . $token . '}') . '/', $params['body_' . $type])) { $dataErrors[] = '
  • ' . ts('This message is having a invalid token - %1: %2', [ - 1 => $token, - 2 => $desc, - ]) . '
  • '; + 1 => $token, + 2 => $desc, + ]) . ''; } } } if (!empty($dataErrors)) { $errors['body_' . $type] = ts('The following errors were detected in %1 message:', [ - 1 => $type, - ]) . '
    ' . ts('More information on tokens...') . ''; + 1 => $type, + ]) . '
    ' . ts('More information on tokens...') . ''; } } return empty($errors) ? TRUE : $errors; diff --git a/CRM/Mailing/Form/ForwardMailing.php b/CRM/Mailing/Form/ForwardMailing.php index 0fa6966707..3d7a04cf2c 100644 --- a/CRM/Mailing/Form/ForwardMailing.php +++ b/CRM/Mailing/Form/ForwardMailing.php @@ -31,6 +31,7 @@ * @copyright CiviCRM LLC (c) 2004-2019 */ class CRM_Mailing_Form_ForwardMailing extends CRM_Core_Form { + public function preProcess() { $job_id = CRM_Utils_Request::retrieve('jid', 'Positive', $this, NULL @@ -139,14 +140,14 @@ class CRM_Mailing_Form_ForwardMailing extends CRM_Core_Form { } $status = ts('Mailing is not forwarded to the given email address.', [ - 'count' => count($emails), - 'plural' => 'Mailing is not forwarded to the given email addresses.', - ]); + 'count' => count($emails), + 'plural' => 'Mailing is not forwarded to the given email addresses.', + ]); if ($forwarded) { $status = ts('Mailing is forwarded successfully to %count email address.', [ - 'count' => $forwarded, - 'plural' => 'Mailing is forwarded successfully to %count email addresses.', - ]); + 'count' => $forwarded, + 'plural' => 'Mailing is forwarded successfully to %count email addresses.', + ]); } CRM_Utils_System::setUFMessage($status); diff --git a/CRM/Mailing/Form/Search.php b/CRM/Mailing/Form/Search.php index c7c3d42eae..d2d6af941e 100644 --- a/CRM/Mailing/Form/Search.php +++ b/CRM/Mailing/Form/Search.php @@ -133,10 +133,9 @@ class CRM_Mailing_Form_Search extends CRM_Core_Form { !CRM_Utils_System::isNull($params[$field]) ) { if (in_array($field, [ - 'mailing_from', - 'mailing_to', - ]) && !$params["mailing_relative"] - ) { + 'mailing_from', + 'mailing_to', + ]) && !$params["mailing_relative"]) { $time = ($field == 'mailing_to') ? '235959' : NULL; $parent->set($field, CRM_Utils_Date::processDate($params[$field], $time)); } diff --git a/CRM/Mailing/Form/Subscribe.php b/CRM/Mailing/Form/Subscribe.php index 91b79e81a3..6a8feae66b 100644 --- a/CRM/Mailing/Form/Subscribe.php +++ b/CRM/Mailing/Form/Subscribe.php @@ -154,17 +154,16 @@ ORDER BY title"; } $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Subscribe'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Subscribe'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); } /** diff --git a/CRM/Mailing/Form/Task.php b/CRM/Mailing/Form/Task.php index e06b8cc1a1..edd13fb523 100644 --- a/CRM/Mailing/Form/Task.php +++ b/CRM/Mailing/Form/Task.php @@ -116,17 +116,16 @@ class CRM_Mailing_Form_Task extends CRM_Core_Form_Task { */ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) { $this->addButtons([ - [ - 'type' => $nextType, - 'name' => $title, - 'isDefault' => TRUE, - ], - [ - 'type' => $backType, - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => $nextType, + 'name' => $title, + 'isDefault' => TRUE, + ], + [ + 'type' => $backType, + 'name' => ts('Cancel'), + ], + ]); } } diff --git a/CRM/Mailing/Form/Task/Print.php b/CRM/Mailing/Form/Task/Print.php index a57f21a40a..0d1322edd4 100644 --- a/CRM/Mailing/Form/Task/Print.php +++ b/CRM/Mailing/Form/Task/Print.php @@ -71,18 +71,17 @@ class CRM_Mailing_Form_Task_Print extends CRM_Mailing_Form_Task { // just need to add a javacript to popup the window for printing // $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Print Mailing Recipients'), - 'js' => ['onclick' => 'window.print()'], - 'isDefault' => TRUE, - ], - [ - 'type' => 'back', - 'name' => ts('Done'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Print Mailing Recipients'), + 'js' => ['onclick' => 'window.print()'], + 'isDefault' => TRUE, + ], + [ + 'type' => 'back', + 'name' => ts('Done'), + ], + ]); } /** diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index 7ed725507d..a674129e54 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -36,11 +36,11 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { /** + * @var string * @inheritDoc */ protected $keyword = 'mailing'; - /** * @inheritDoc * @return array @@ -78,7 +78,8 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { foreach ($reportTypes as $report) { $result = civicrm_api3('ReportInstance', 'get', [ 'sequential' => 1, - 'report_id' => 'mailing/' . $report]); + 'report_id' => 'mailing/' . $report, + ]); if (!empty($result['values'])) { $reportIds[$report] = $result['values'][0]['id']; } @@ -150,9 +151,9 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { 'disableMandatoryTokensCheck' => (int) Civi::settings()->get('disable_mandatory_tokens_check'), 'fromAddress' => $fromAddress['values'], 'defaultTestEmail' => civicrm_api3('Contact', 'getvalue', [ - 'id' => 'user_contact_id', - 'return' => 'email', - ]), + 'id' => 'user_contact_id', + 'return' => 'email', + ]), 'visibility' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::groupVisibility()), 'workflowEnabled' => CRM_Mailing_Info::workflowEnabled(), 'reportIds' => $reportIds, @@ -245,7 +246,6 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { return $permissions; } - /** * @inheritDoc * @return null diff --git a/CRM/Mailing/MailStore.php b/CRM/Mailing/MailStore.php index bb94c529a1..86b79c38b3 100644 --- a/CRM/Mailing/MailStore.php +++ b/CRM/Mailing/MailStore.php @@ -31,8 +31,11 @@ * @copyright CiviCRM LLC (c) 2004-2019 */ class CRM_Mailing_MailStore { - // flag to decide whether to print debug messages - var $_debug = FALSE; + /** + * flag to decide whether to print debug messages + * @var bool + */ + public $_debug = FALSE; /** * Return the proper mail store implementation, based on config settings. @@ -153,10 +156,10 @@ class CRM_Mailing_MailStore { $config = CRM_Core_Config::singleton(); $dir = $config->customFileUploadDir . DIRECTORY_SEPARATOR . $name; foreach ([ - 'cur', - 'new', - 'tmp', - ] as $sub) { + 'cur', + 'new', + 'tmp', + ] as $sub) { if (!file_exists($dir . DIRECTORY_SEPARATOR . $sub)) { if ($this->_debug) { print "creating $dir/$sub\n"; diff --git a/CRM/Mailing/MailStore/Localdir.php b/CRM/Mailing/MailStore/Localdir.php index 87a0a4f185..8e9c66f1c8 100644 --- a/CRM/Mailing/MailStore/Localdir.php +++ b/CRM/Mailing/MailStore/Localdir.php @@ -48,17 +48,17 @@ class CRM_Mailing_MailStore_Localdir extends CRM_Mailing_MailStore { $this->_dir = $dir; $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, [ - 'CiviMail.ignored', - date('Y'), - date('m'), - date('d'), - ])); + 'CiviMail.ignored', + date('Y'), + date('m'), + date('d'), + ])); $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, [ - 'CiviMail.processed', - date('Y'), - date('m'), - date('d'), - ])); + 'CiviMail.processed', + date('Y'), + date('m'), + date('d'), + ])); } /** diff --git a/CRM/Mailing/MailStore/Maildir.php b/CRM/Mailing/MailStore/Maildir.php index c0b5855395..90b371026e 100644 --- a/CRM/Mailing/MailStore/Maildir.php +++ b/CRM/Mailing/MailStore/Maildir.php @@ -48,17 +48,17 @@ class CRM_Mailing_MailStore_Maildir extends CRM_Mailing_MailStore { $this->_dir = $dir; $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, [ - 'CiviMail.ignored', - date('Y'), - date('m'), - date('d'), - ])); + 'CiviMail.ignored', + date('Y'), + date('m'), + date('d'), + ])); $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, [ - 'CiviMail.processed', - date('Y'), - date('m'), - date('d'), - ])); + 'CiviMail.processed', + date('Y'), + date('m'), + date('d'), + ])); } /** @@ -78,9 +78,9 @@ class CRM_Mailing_MailStore_Maildir extends CRM_Mailing_MailStore { $parser->options->parseTextAttachmentsAsFiles = TRUE; foreach ([ - 'cur', - 'new', - ] as $subdir) { + 'cur', + 'new', + ] as $subdir) { $dir = $this->_dir . DIRECTORY_SEPARATOR . $subdir; foreach (scandir($dir) as $file) { if ($file == '.' or $file == '..') { diff --git a/CRM/Mailing/MailStore/Mbox.php b/CRM/Mailing/MailStore/Mbox.php index c1679a4aaf..6ffadf4166 100644 --- a/CRM/Mailing/MailStore/Mbox.php +++ b/CRM/Mailing/MailStore/Mbox.php @@ -51,17 +51,17 @@ class CRM_Mailing_MailStore_Mbox extends CRM_Mailing_MailStore { $this->_leftToProcess = count($this->_transport->listMessages()); $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, [ - 'CiviMail.ignored', - date('Y'), - date('m'), - date('d'), - ])); + 'CiviMail.ignored', + date('Y'), + date('m'), + date('d'), + ])); $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, [ - 'CiviMail.processed', - date('Y'), - date('m'), - date('d'), - ])); + 'CiviMail.processed', + date('Y'), + date('m'), + date('d'), + ])); } /** diff --git a/CRM/Mailing/MailStore/Pop3.php b/CRM/Mailing/MailStore/Pop3.php index f30f741a98..c552c3e18c 100644 --- a/CRM/Mailing/MailStore/Pop3.php +++ b/CRM/Mailing/MailStore/Pop3.php @@ -60,17 +60,17 @@ class CRM_Mailing_MailStore_Pop3 extends CRM_Mailing_MailStore { $this->_transport->authenticate($username, $password); $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, [ - 'CiviMail.ignored', - date('Y'), - date('m'), - date('d'), - ])); + 'CiviMail.ignored', + date('Y'), + date('m'), + date('d'), + ])); $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, [ - 'CiviMail.processed', - date('Y'), - date('m'), - date('d'), - ])); + 'CiviMail.processed', + date('Y'), + date('m'), + date('d'), + ])); } /** diff --git a/CRM/Mailing/Page/Component.php b/CRM/Mailing/Page/Component.php index 24d90b3386..055f42d8ee 100644 --- a/CRM/Mailing/Page/Component.php +++ b/CRM/Mailing/Page/Component.php @@ -42,7 +42,7 @@ class CRM_Mailing_Page_Component extends CRM_Core_Page_Basic { * * @var array */ - static $_links = NULL; + public static $_links = NULL; /** * Get BAO Name. diff --git a/CRM/Mailing/Page/Confirm.php b/CRM/Mailing/Page/Confirm.php index fc159675c6..b126dac428 100644 --- a/CRM/Mailing/Page/Confirm.php +++ b/CRM/Mailing/Page/Confirm.php @@ -31,6 +31,7 @@ * @copyright CiviCRM LLC (c) 2004-2019 */ class CRM_Mailing_Page_Confirm extends CRM_Core_Page { + /** * @return string * @throws Exception diff --git a/CRM/Mailing/Page/Optout.php b/CRM/Mailing/Page/Optout.php index 402d047c72..c03a8076f2 100644 --- a/CRM/Mailing/Page/Optout.php +++ b/CRM/Mailing/Page/Optout.php @@ -31,6 +31,7 @@ * @copyright CiviCRM LLC (c) 2004-2019 */ class CRM_Mailing_Page_Optout extends CRM_Mailing_Page_Common { + /** * Run page. * diff --git a/CRM/Mailing/Page/Resubscribe.php b/CRM/Mailing/Page/Resubscribe.php index 6ce256123b..8df64a00b9 100644 --- a/CRM/Mailing/Page/Resubscribe.php +++ b/CRM/Mailing/Page/Resubscribe.php @@ -31,6 +31,7 @@ * @copyright CiviCRM LLC (c) 2004-2019 */ class CRM_Mailing_Page_Resubscribe extends CRM_Mailing_Page_Common { + /** * @return string */ diff --git a/CRM/Mailing/Page/Tab.php b/CRM/Mailing/Page/Tab.php index 66a7200f1c..5af444db8f 100644 --- a/CRM/Mailing/Page/Tab.php +++ b/CRM/Mailing/Page/Tab.php @@ -40,7 +40,7 @@ class CRM_Mailing_Page_Tab extends CRM_Contact_Page_View { * * @var array */ - static $_links = NULL; + public static $_links = NULL; public $_permission = NULL; public $_contactId = NULL; diff --git a/CRM/Mailing/PseudoConstant.php b/CRM/Mailing/PseudoConstant.php index d6186b9d34..c2e43ff7a9 100644 --- a/CRM/Mailing/PseudoConstant.php +++ b/CRM/Mailing/PseudoConstant.php @@ -75,6 +75,7 @@ class CRM_Mailing_PseudoConstant extends CRM_Core_PseudoConstant { /** * Default component id's, indexed by component type + * @var array */ private static $defaultComponent; @@ -117,7 +118,7 @@ class CRM_Mailing_PseudoConstant extends CRM_Core_PseudoConstant { */ public static function abWinnerCriteria() { if (!is_array(self::$abWinnerCriteria)) { - self::$abWinnerCriteria = [ + self::$abWinnerCriteria = [ 'open' => ts('Open'), 'unique_click' => ts('Total Unique Clicks'), 'link_click' => ts('Total Clicks on a particular link'), @@ -131,7 +132,7 @@ class CRM_Mailing_PseudoConstant extends CRM_Core_PseudoConstant { */ public static function mailingTypes() { if (!is_array(self::$mailingTypes)) { - self::$mailingTypes = [ + self::$mailingTypes = [ 'standalone' => ts('Standalone'), 'experiment' => ts('Experimental'), 'winner' => ts('Winner'), diff --git a/CRM/Mailing/Selector/Browse.php b/CRM/Mailing/Selector/Browse.php index 84014a0b1b..1f4aa41c55 100644 --- a/CRM/Mailing/Selector/Browse.php +++ b/CRM/Mailing/Selector/Browse.php @@ -41,14 +41,14 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_ * * @var array */ - static $_links = NULL; + public static $_links = NULL; /** * We use desc to remind us what that column is, name is used in the tpl * * @var array */ - static $_columnHeaders; + public static $_columnHeaders; protected $_parent; diff --git a/CRM/Mailing/Selector/Event.php b/CRM/Mailing/Selector/Event.php index 0354321a92..618cbc3e4f 100644 --- a/CRM/Mailing/Selector/Event.php +++ b/CRM/Mailing/Selector/Event.php @@ -43,30 +43,35 @@ class CRM_Mailing_Selector_Event extends CRM_Core_Selector_Base implements CRM_C * * @var array */ - static $_links = NULL; + public static $_links = NULL; /** * What event type are we browsing? + * @var sting */ private $_event; /** * Should we only count distinct contacts? + * @var bool */ private $_is_distinct; /** * Which mailing are we browsing events from? + * @var int */ private $_mailing_id; /** * Do we want events tied to a specific job? + * @var int */ private $_job_id; /** * For click-through events, do we only want those from a specific url? + * @var int */ private $_url_id; diff --git a/CRM/Mailing/Selector/Search.php b/CRM/Mailing/Selector/Search.php index 2417a7ed2a..e50406bd83 100644 --- a/CRM/Mailing/Selector/Search.php +++ b/CRM/Mailing/Selector/Search.php @@ -43,20 +43,20 @@ class CRM_Mailing_Selector_Search extends CRM_Core_Selector_Base implements CRM_ * * @var array */ - static $_links = NULL; + public static $_links = NULL; /** * We use desc to remind us what that column is, name is used in the tpl * * @var array */ - static $_columnHeaders; + public static $_columnHeaders; /** * Properties of contact we're interested in displaying * @var array */ - static $_properties = [ + public static $_properties = [ 'contact_id', 'mailing_id', 'mailing_name', diff --git a/CRM/Mailing/Task.php b/CRM/Mailing/Task.php index 65664796e6..32a4b0ff74 100644 --- a/CRM/Mailing/Task.php +++ b/CRM/Mailing/Task.php @@ -38,7 +38,7 @@ */ class CRM_Mailing_Task extends CRM_Core_Task { - static $objectType = 'mailing'; + public static $objectType = 'mailing'; /** * These tasks are the core set of tasks that the user can perform -- 2.25.1