Merge pull request #16126 from civicrm/5.21
[civicrm-core.git] / CRM / Utils / Recent.php
index 88c8946f839e929b31d6bc695b1e90b6009f22ce..f70c76c2e35f146febd21ae4e900146ff571e88e 100644 (file)
@@ -1,33 +1,17 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019                                |
- +--------------------------------------------------------------------+
- | 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.   |
+ | Copyright CiviCRM LLC. All rights reserved.                        |
  |                                                                    |
- | 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        |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
  */
 
 /**
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
  */
 
 /**
@@ -67,7 +51,7 @@ class CRM_Utils_Recent {
       $session = CRM_Core_Session::singleton();
       self::$_recent = $session->get(self::STORE_NAME);
       if (!self::$_recent) {
-        self::$_recent = array();
+        self::$_recent = [];
       }
     }
   }
@@ -104,7 +88,7 @@ class CRM_Utils_Recent {
     $type,
     $contactId,
     $contactName,
-    $others = array()
+    $others = []
   ) {
     self::initialize();
 
@@ -124,11 +108,11 @@ class CRM_Utils_Recent {
     }
 
     if (!is_array($others)) {
-      $others = array();
+      $others = [];
     }
 
     array_unshift(self::$_recent,
-      array(
+      [
         'title' => $title,
         'url' => $url,
         'id' => $id,
@@ -140,7 +124,7 @@ class CRM_Utils_Recent {
         'image_url' => CRM_Utils_Array::value('imageUrl', $others),
         'edit_url' => CRM_Utils_Array::value('editUrl', $others),
         'delete_url' => CRM_Utils_Array::value('deleteUrl', $others),
-      )
+      ]
     );
 
     if (count(self::$_recent) > self::$_maxItems) {
@@ -162,7 +146,7 @@ class CRM_Utils_Recent {
     self::initialize();
     $tempRecent = self::$_recent;
 
-    self::$_recent = array();
+    self::$_recent = [];
 
     // make sure item is not already present in list
     for ($i = 0; $i < count($tempRecent); $i++) {
@@ -190,7 +174,7 @@ class CRM_Utils_Recent {
 
     $tempRecent = self::$_recent;
 
-    self::$_recent = array();
+    self::$_recent = [];
 
     // rebuild recent.
     for ($i = 0; $i < count($tempRecent); $i++) {
@@ -237,7 +221,7 @@ class CRM_Utils_Recent {
    * @return array
    */
   public static function getProviders() {
-    $providers = array(
+    $providers = [
       'Contact' => ts('Contacts'),
       'Relationship' => ts('Relationships'),
       'Activity' => ts('Activities'),
@@ -251,7 +235,7 @@ class CRM_Utils_Recent {
       'Pledge' => ts('Pledges'),
       'Event' => ts('Events'),
       'Campaign' => ts('Campaigns'),
-    );
+    ];
 
     return $providers;
   }