<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
- +--------------------------------------------------------------------+
- | 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-2018
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
$session = CRM_Core_Session::singleton();
self::$_recent = $session->get(self::STORE_NAME);
if (!self::$_recent) {
- self::$_recent = array();
+ self::$_recent = [];
}
}
}
$type,
$contactId,
$contactName,
- $others = array()
+ $others = []
) {
self::initialize();
// make sure item is not already present in list
for ($i = 0; $i < count(self::$_recent); $i++) {
- if (self::$_recent[$i]['type'] === $type && self::$_recent[$i]['id'] === $id) {
+ if (self::$_recent[$i]['type'] === $type && self::$_recent[$i]['id'] == $id) {
// delete item from array
array_splice(self::$_recent, $i, 1);
break;
}
if (!is_array($others)) {
- $others = array();
+ $others = [];
}
array_unshift(self::$_recent,
- array(
+ [
'title' => $title,
'url' => $url,
'id' => $id,
'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) {
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++) {
}
}
+ CRM_Utils_Hook::recent(self::$_recent);
$session = CRM_Core_Session::singleton();
$session->set(self::STORE_NAME, self::$_recent);
}
$tempRecent = self::$_recent;
- self::$_recent = array();
+ self::$_recent = [];
// rebuild recent.
for ($i = 0; $i < count($tempRecent); $i++) {
self::$_recent[] = $tempRecent[$i];
}
+ CRM_Utils_Hook::recent(self::$_recent);
$session = CRM_Core_Session::singleton();
$session->set(self::STORE_NAME, self::$_recent);
}
/**
* Check if a provider is allowed to add stuff.
- * If correspondig setting is empty, all are allowed
+ * If corresponding setting is empty, all are allowed
*
* @param string $providerName
+ * @return bool
*/
public static function isProviderEnabled($providerName) {
/**
* Gets the list of available providers to civi's recent items stack
+ *
+ * @return array
*/
public static function getProviders() {
- $providers = array(
+ $providers = [
'Contact' => ts('Contacts'),
'Relationship' => ts('Relationships'),
'Activity' => ts('Activities'),
'Pledge' => ts('Pledges'),
'Event' => ts('Events'),
'Campaign' => ts('Campaigns'),
- );
+ ];
return $providers;
}