* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
-require_once 'CRM/Core/I18n.php';
-
/**
* Class CRM_Core_Menu.
*/
*/
public static $_permissionedItems = NULL;
- public static $_serializedElements = array(
+ public static $_serializedElements = [
'access_arguments',
'access_callback',
'page_arguments',
'page_callback',
'breadcrumb',
- );
+ ];
public static $_menuCache = NULL;
const MENU_ITEM = 1;
*/
public static function &xmlItems($fetchFromXML = FALSE) {
if (!self::$_items || $fetchFromXML) {
- $config = CRM_Core_Config::singleton();
-
// We needs this until Core becomes a component
$coreMenuFilesNamespace = 'CRM_Core_xml_Menu';
$coreMenuFilesPath = str_replace('_', DIRECTORY_SEPARATOR, $coreMenuFilesNamespace);
if ($item->ids_arguments) {
$ids = [];
- foreach (array('json' => 'json', 'html' => 'html', 'exception' => 'exceptions') as $tag => $attr) {
+ foreach (['json' => 'json', 'html' => 'html', 'exception' => 'exceptions'] as $tag => $attr) {
$ids[$attr] = [];
foreach ($item->ids_arguments->{$tag} as $value) {
$ids[$attr][] = (string) $value;
foreach ($elements as $element) {
$items[] = $element;
}
- $value = array($items, $op);
+ $value = [$items, $op];
}
else {
- $value = array(array($value), 'and');
+ $value = [[$value], 'and'];
}
}
elseif ($key == 'is_public' || $key == 'is_ssl') {
*
* @return bool
*/
- public static function isArrayTrue(&$values) {
- foreach ($values as $name => $value) {
+ public static function isArrayTrue($values) {
+ foreach ($values as $value) {
if (!$value) {
return FALSE;
}
* @throws CRM_Core_Exception
*/
public static function fillMenuValues(&$menu, $path) {
- $fieldsToPropagate = array(
+ $fieldsToPropagate = [
'access_callback',
'access_arguments',
'page_callback',
'page_arguments',
'is_ssl',
- );
+ ];
$fieldsPresent = [];
foreach ($fieldsToPropagate as $field) {
$fieldsPresent[$field] = isset($menu[$path][$field]);
$query = !empty($item['path_arguments']) ? str_replace(',', '&', $item['path_arguments']) . '&reset=1' : 'reset=1';
- $value = array(
+ $value = [
'title' => $item['title'],
'desc' => $item['desc'] ?? NULL,
- 'id' => strtr($item['title'], array(
+ 'id' => strtr($item['title'], [
'(' => '_',
')' => '',
' ' => '',
',' => '_',
'/' => '_',
- )),
+ ]),
'url' => CRM_Utils_System::url($path, $query,
FALSE,
NULL,
),
'icon' => $item['icon'] ?? NULL,
'extra' => $item['extra'] ?? NULL,
- );
+ ];
if (!array_key_exists($item['adminGroup'], $values)) {
$values[$item['adminGroup']] = [];
$values[$item['adminGroup']]['fields'] = [];
ksort($values[$group]);
}
- $menu['admin'] = array('breadcrumb' => $values);
+ $menu['admin'] = ['breadcrumb' => $values];
}
/**
* Get admin links.
*
- * @return null
+ * @return array|null
*/
- public static function &getAdminLinks() {
+ public static function getAdminLinks() {
$links = self::get('admin');
-
- if (!$links ||
- !isset($links['breadcrumb'])
- ) {
- return NULL;
- }
-
- $values = &$links['breadcrumb'];
- return $values;
+ return $links['breadcrumb'] ?? NULL;
}
/**
isset($menu[$currentPath]['title'])
) {
$urlVar = !empty($menu[$currentPath]['path_arguments']) ? '&' . $menu[$currentPath]['path_arguments'] : '';
- $crumbs[] = array(
+ $crumbs[] = [
'title' => $menu[$currentPath]['title'],
'url' => CRM_Utils_System::url($currentPath,
'reset=1' . $urlVar,
// forceBackend; CRM-14439 work-around; acceptable for now because we don't display breadcrumbs on frontend
TRUE
),
- );
+ ];
}
}
$menu[$path]['breadcrumb'] = $crumbs;
array_pop($pathElements);
if (empty($pathElements)) {
- return array(NULL, NULL);
+ return [NULL, NULL];
}
$newPath = implode('/', $pathElements);
return self::getReturnUrl($menu, $newPath);
}
else {
- return array(
- CRM_Utils_Array::value('return_url',
- $menu[$path]
- ),
- CRM_Utils_Array::value('return_url_args',
- $menu[$path]
- ),
- );
+ return [
+ $menu[$path]['return_url'] ?? NULL,
+ $menu[$path]['return_url_args'] ?? NULL,
+ ];
}
}
* Menu entry array.
*/
public static function get($path) {
- // return null if menu rebuild
- $config = CRM_Core_Config::singleton();
-
$args = explode('/', $path);
$elements = [];
}
}
- // *FIXME* : hack for 4.1 -> 4.2 upgrades.
if (preg_match('/^civicrm\/(upgrade\/)?queue\//', $path)) {
CRM_Queue_Menu::alter($path, $menuPath);
}
- // Part of upgrade framework but not run inside main upgrade because it deletes data
- // Once we have another example of a 'cleanup' we should generalize the clause below so it grabs string
- // which follows upgrade/ and checks for existence of a function in Cleanup class.
- if ($path == 'civicrm/upgrade/cleanup425') {
- $menuPath['page_callback'] = array('CRM_Upgrade_Page_Cleanup', 'cleanup425');
- $menuPath['access_arguments'][0][] = 'administer CiviCRM';
- $menuPath['access_callback'] = array('CRM_Core_Permission', 'checkMenu');
- }
-
if (!empty($menuPath)) {
$i18n = CRM_Core_I18n::singleton();
$i18n->localizeTitles($menuPath);
if (!is_string($pathArgs)) {
return;
}
- $args = [];
+ $arr = [];
$elements = explode(',', $pathArgs);
foreach ($elements as $keyVal) {
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC. All rights reserved. |
- | |
- | 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 |
- +--------------------------------------------------------------------+
- */
-
-/**
- * Class CRM_Upgrade_Page_Cleanup
- */
-class CRM_Upgrade_Page_Cleanup extends CRM_Core_Page {
-
- public function cleanup425() {
- $rows = CRM_Upgrade_Incremental_php_FourTwo::deleteInvalidPairs();
- $template = CRM_Core_Smarty::singleton();
-
- $columnHeaders = [
- "Contact ID",
- "ContributionID",
- "Contribution Status",
- "MembershipID",
- "Membership Type",
- "Start Date",
- "End Date",
- "Membership Status",
- "Action",
- ];
- $template->assign('columnHeaders', $columnHeaders);
- $template->assign('rows', $rows);
-
- $preMessage = !empty($rows) ? ts('The following records have been processed. Membership records with action = Un-linked have been disconnected from the listed contribution record:') : ts('Could not find any records to process.');
- $template->assign('preMessage', $preMessage);
-
- $postMessage = ts('You can <a href="%1">click here</a> to try running the 4.2 upgrade script again. <a href="%2" target="_blank">(Review upgrade documentation)</a>',
- [
- 1 => CRM_Utils_System::url('civicrm/upgrade', 'reset=1'),
- 2 => CRM_Utils_System::docURL2('sysadmin/upgrade', TRUE),
- ]);
- $template->assign('postMessage', $postMessage);
-
- $content = $template->fetch('CRM/common/upgradeCleanup.tpl');
- echo CRM_Utils_System::theme($content, FALSE, TRUE);
- }
-
-}