本文整理匯總了PHP中TYPO3\CMS\Core\Utility\ArrayUtility::naturalKeySortRecursive方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayUtility::naturalKeySortRecursive方法的具體用法?PHP ArrayUtility::naturalKeySortRecursive怎麽用?PHP ArrayUtility::naturalKeySortRecursive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Core\Utility\ArrayUtility
的用法示例。
在下文中一共展示了ArrayUtility::naturalKeySortRecursive方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: main
/**
* Main function
*
* @return void
*/
public function main()
{
/** @var ArrayBrowser $arrayBrowser */
$arrayBrowser = GeneralUtility::makeInstance(ArrayBrowser::class);
$label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
$search_field = GeneralUtility::_GP('search_field');
$templatePathAndFilename = GeneralUtility::getFileAbsFileName('EXT:lowlevel/Resources/Private/Templates/Backend/Configuration.html');
$this->view->setTemplatePathAndFilename($templatePathAndFilename);
$this->view->assign('label', $label);
$this->view->assign('search_field', $search_field);
$this->view->assign('checkbox_checkRegexsearch', BackendUtility::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"'));
switch ($this->MOD_SETTINGS['function']) {
case 0:
$theVar = $GLOBALS['TYPO3_CONF_VARS'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TYPO3_CONF_VARS';
break;
case 1:
$theVar = $GLOBALS['TCA'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TCA';
break;
case 2:
$theVar = $GLOBALS['TCA_DESCR'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TCA_DESCR';
break;
case 3:
$theVar = $GLOBALS['TYPO3_LOADED_EXT'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TYPO3_LOADED_EXT';
break;
case 4:
$theVar = $GLOBALS['T3_SERVICES'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$T3_SERVICES';
break;
case 5:
$theVar = $GLOBALS['TBE_MODULES'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TBE_MODULES';
break;
case 6:
$theVar = $GLOBALS['TBE_MODULES_EXT'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TBE_MODULES_EXT';
break;
case 7:
$theVar = $GLOBALS['TBE_STYLES'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TBE_STYLES';
break;
case 8:
$theVar = $GLOBALS['BE_USER']->uc;
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$BE_USER->uc';
break;
case 9:
$theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TYPO3_USER_SETTINGS';
break;
default:
$theVar = array();
}
// Update node:
$update = 0;
$node = GeneralUtility::_GET('node');
// If any plus-signs were clicked, it's registered.
if (is_array($node)) {
$this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]);
$update = 1;
}
if ($update) {
$this->getBackendUser()->pushModuleData($this->moduleName, $this->MOD_SETTINGS);
}
$arrayBrowser->dontLinkVar = true;
$arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']];
$arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
$arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
$arrayBrowser->searchKeysToo = true;
// If any POST-vars are send, update the condition array
if (GeneralUtility::_POST('search') && trim($search_field)) {
$arrayBrowser->depthKeys = $arrayBrowser->getSearchKeys($theVar, '', $search_field, array());
}
// mask sensitive information
$varName = trim($arrayBrowser->varName, '$');
if (isset($this->blindedConfigurationOptions[$varName])) {
ArrayUtility::mergeRecursiveWithOverrule($theVar, $this->blindedConfigurationOptions[$varName]);
}
$tree = $arrayBrowser->tree($theVar, '', '');
$this->view->assign('tree', $tree);
// Setting up the shortcut button for docheader
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
// Shortcut
//.........這裏部分代碼省略.........
示例2: naturalKeySortRecursiveSortsMultiDimensionalArrayByNaturalOrder
/**
* @test
*/
public function naturalKeySortRecursiveSortsMultiDimensionalArrayByNaturalOrder()
{
$testArray = array('2' => '2', 'bb' => 'bb', 'ab' => 'ab', '23' => '23', 'aaa' => array('bb' => 'bb', 'ab' => 'ab', '123' => '123', 'aaa' => 'aaa', '2' => '2', 'abc' => 'abc', 'ba' => 'ba', '23' => '23', 'bad' => array('bb' => 'bb', 'ab' => 'ab', '123' => '123', 'aaa' => 'aaa', 'abc' => 'abc', '23' => '23', 'ba' => 'ba', 'bad' => 'bad', '2' => '2', 'zap' => 'zap', '210' => '210'), '210' => '210', 'zap' => 'zap'), 'abc' => 'abc', 'ba' => 'ba', '210' => '210', 'bad' => 'bad', '123' => '123', 'zap' => 'zap');
$expectedResult = array('2', '23', '123', '210', 'aaa', 'ab', 'abc', 'ba', 'bad', 'bb', 'zap');
ArrayUtility::naturalKeySortRecursive($testArray);
$this->assertEquals($expectedResult, array_values(array_keys($testArray['aaa']['bad'])));
$this->assertEquals($expectedResult, array_values(array_keys($testArray['aaa'])));
$this->assertEquals($expectedResult, array_values(array_keys($testArray)));
}
示例3: naturalKeySortRecursive
/**
* Sorts an array by key recursive - uses natural sort order (aAbB-zZ)
*
* @param array $array array to be sorted recursively, passed by reference
* @return bool TRUE if param is an array
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - use ArrayUtility::naturalKeySortRecursive() instead
*/
public static function naturalKeySortRecursive(&$array)
{
static::logDeprecatedFunction();
return ArrayUtility::naturalKeySortRecursive($array);
}
示例4: main
/**
* Main function
*
* @return void
*/
public function main()
{
/** @var ArrayBrowser $arrayBrowser */
$arrayBrowser = GeneralUtility::makeInstance(ArrayBrowser::class);
$label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
$search_field = GeneralUtility::_GP('search_field');
$templatePathAndFilename = GeneralUtility::getFileAbsFileName('EXT:lowlevel/Resources/Private/Templates/Backend/Configuration.html');
$this->view->setTemplatePathAndFilename($templatePathAndFilename);
$this->view->assign('label', $label);
$this->view->assign('search_field', $search_field);
$this->view->assign('checkbox_checkRegexsearch', BackendUtility::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"'));
switch ($this->MOD_SETTINGS['function']) {
case 0:
$theVar = $GLOBALS['TYPO3_CONF_VARS'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TYPO3_CONF_VARS';
break;
case 1:
$theVar = $GLOBALS['TCA'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TCA';
break;
case 2:
$theVar = $GLOBALS['TCA_DESCR'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TCA_DESCR';
break;
case 3:
$theVar = $GLOBALS['TYPO3_LOADED_EXT'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TYPO3_LOADED_EXT';
break;
case 4:
$theVar = $GLOBALS['T3_SERVICES'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$T3_SERVICES';
break;
case 5:
$theVar = $GLOBALS['TBE_MODULES'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TBE_MODULES';
break;
case 6:
$theVar = $GLOBALS['TBE_MODULES_EXT'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TBE_MODULES_EXT';
break;
case 7:
$theVar = $GLOBALS['TBE_STYLES'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TBE_STYLES';
break;
case 8:
$theVar = $GLOBALS['BE_USER']->uc;
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$BE_USER->uc';
break;
case 9:
$theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TYPO3_USER_SETTINGS';
break;
default:
$theVar = array();
}
// Update node:
$update = 0;
$node = GeneralUtility::_GET('node');
// If any plus-signs were clicked, it's registred.
if (is_array($node)) {
$this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]);
$update = 1;
}
if ($update) {
$this->getBackendUser()->pushModuleData($this->moduleName, $this->MOD_SETTINGS);
}
$arrayBrowser->dontLinkVar = TRUE;
$arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']];
$arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
$arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
$arrayBrowser->searchKeysToo = TRUE;
// If any POST-vars are send, update the condition array
if (GeneralUtility::_POST('search') && trim($search_field)) {
$arrayBrowser->depthKeys = $arrayBrowser->getSearchKeys($theVar, '', $search_field, array());
}
// mask the encryption key to not show it as plaintext in the configuration module
if ($theVar == $GLOBALS['TYPO3_CONF_VARS']) {
$theVar['SYS']['encryptionKey'] = '***** (length: ' . strlen($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']) . ' characters)';
}
$tree = $arrayBrowser->tree($theVar, '', '');
$this->view->assign('tree', $tree);
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
$markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => $this->getFuncMenu(), 'CONTENT' => $this->view->render());
// Build the <body> for the module
//.........這裏部分代碼省略.........