本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::array_merge_recursive_overrule方法的具体用法?PHP GeneralUtility::array_merge_recursive_overrule怎么用?PHP GeneralUtility::array_merge_recursive_overrule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::array_merge_recursive_overrule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* @return mixed
*/
public function render()
{
// Get page via pageUid argument or current id
$pageUid = intval($this->arguments['pageUid']);
if (0 === $pageUid) {
$pageUid = $GLOBALS['TSFE']->id;
}
$page = $this->pageSelect->getPage($pageUid);
// Add the page overlay
$languageUid = intval($GLOBALS['TSFE']->sys_language_uid);
if (0 !== $languageUid) {
$pageOverlay = $this->pageSelect->getPageOverlay($pageUid, $languageUid);
if (TRUE === is_array($pageOverlay)) {
if (TRUE === method_exists('TYPO3\\CMS\\Core\\Utility\\ArrayUtility', 'mergeRecursiveWithOverrule')) {
ArrayUtility::mergeRecursiveWithOverrule($page, $pageOverlay, FALSE, FALSE);
} else {
$page = GeneralUtility::array_merge_recursive_overrule($page, $pageOverlay, FALSE, FALSE);
}
}
}
$content = NULL;
// Check if field should be returned or assigned
$field = $this->arguments['field'];
if (TRUE === empty($field)) {
$content = $page;
} elseif (TRUE === isset($page[$field])) {
$content = $page[$field];
}
return $this->renderChildrenWithVariableOrReturnInput($content);
}
示例2: render
/**
* @return mixed
*/
public function render()
{
// Get page via pageUid argument or current id
$pageUid = intval($this->arguments['pageUid']);
if (0 === $pageUid) {
$pageUid = $GLOBALS['TSFE']->id;
}
$page = $this->pageSelect->getPage($pageUid);
// Add the page overlay
$languageUid = intval($GLOBALS['TSFE']->sys_language_uid);
if (0 !== $languageUid) {
$pageOverlay = $this->pageSelect->getPageOverlay($pageUid, $languageUid);
if (TRUE === is_array($pageOverlay)) {
$page = GeneralUtility::array_merge_recursive_overrule($page, $pageOverlay, FALSE, FALSE);
}
}
$content = NULL;
// Check if field should be returned or assigned
$field = $this->arguments['field'];
if (TRUE === empty($field)) {
$content = $page;
} elseif (TRUE === isset($page[$field])) {
$content = $page[$field];
}
// Return if no assign
$as = $this->arguments['as'];
if (TRUE === empty($as)) {
return $content;
}
$variables = array($as => $content);
$output = ViewHelperUtility::renderChildrenWithVariables($this, $this->templateVariableContainer, $variables);
return $output;
}
示例3: init
/**
* Init the plugin
*
* @return void
*/
public function init()
{
// default piVars
if (is_array($this->conf['_DEFAULT_PI_VARS.'])) {
$this->piVars = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($this->conf['_DEFAULT_PI_VARS.'], is_array($this->piVars) ? $this->piVars : array());
}
// needed classes
$this->template = new tx_t3devapi_templating($this);
$this->misc = new tx_t3devapi_miscellaneous($this);
$this->conf = $this->getArrayConfig();
// Additionnal TS
if (empty($this->conf['myTS']) === false) {
$this->conf = $this->misc->loadTS($this->conf, $this->conf['myTS']);
}
// Debug
$this->conf['debug'] = $this->conf['debug'] == 1 ? true : false;
// Check conf profile
$this->conf['profile'] = $this->conf['profile'] == 1 ? true : false;
$this->profileStart();
// Path to the HTML template
if (empty($this->conf['templateFile']) === false) {
$this->addTemplate($this->conf['templateFile']);
} else {
$this->addTemplate('typo3conf/ext/' . $this->extKey . '/res/template.html');
}
// locallangs array
$this->conf['locallang'] = $this->misc->loadLL('typo3conf/ext/' . $this->extKey . '/' . dirname($this->scriptRelPath) . '/locallang.xml', null, $this->conf['_LOCAL_LANG.']);
$this->conf['markerslocallang'] = $this->misc->convertToMarkerArray($this->conf['locallang'], 'LLL:');
// upload path
$this->uploadPath = 'uploads/tx_' . $this->extKey . '/';
}
示例4: render
/**
* Merges arrays/Traversables $a and $b into an array
*
* @param mixed $a First array/Traversable
* @param mixed $b Second array/Traversable
* @param boolean $useKeys If TRUE, comparison is done while also observing (and merging) the keys used in each array
* @return array
*/
public function render($a, $b, $useKeys = TRUE)
{
$this->useKeys = (bool) $useKeys;
$a = ViewHelperUtility::arrayFromArrayOrTraversableOrCSV($a, $useKeys);
$b = ViewHelperUtility::arrayFromArrayOrTraversableOrCSV($b, $useKeys);
$merged = GeneralUtility::array_merge_recursive_overrule($a, $b);
return $merged;
}
示例5: saveAction
/**
* Save configuration to file
* Merges existing with new configuration.
*
* @param array $config The new extension configuration
* @param string $extensionKey The extension key
* @return void
*/
public function saveAction(array $config, $extensionKey)
{
/** @var $configurationUtility \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility */
$configurationUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility');
$currentFullConfiguration = $configurationUtility->getCurrentConfiguration($extensionKey);
$newConfiguration = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($currentFullConfiguration, $config);
$configurationUtility->writeConfiguration($configurationUtility->convertValuedToNestedConfiguration($newConfiguration), $extensionKey);
$this->redirect('showConfigurationForm', NULL, NULL, array('extension' => array('key' => $extensionKey)));
}
示例6: array_merge_recursive_overrule
/**
* Implements array_merge_recursive_overrule() in a cross-version way
* This code is a copy from realurl, written by Dmitry Dulepov <dmitry.dulepov@gmail.com>.
*
* @access public
*
* @param array $array1: First array
* @param array $array2: Second array
*
* @return array Merged array with second array overruling first one
*/
public static function array_merge_recursive_overrule($array1, $array2)
{
if (class_exists('\\TYPO3\\CMS\\Core\\Utility\\ArrayUtility')) {
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($array1, $array2);
} else {
$array1 = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($array1, $array2);
}
return $array1;
}
示例7: mergeArrays
/**
* @param $array1
* @param $array2
* @return array
*/
protected function mergeArrays($array1, $array2)
{
if (6.2 <= (double) substr(TYPO3_version, 0, 3)) {
ArrayUtility::mergeRecursiveWithOverrule($array1, $array2);
return $array1;
} else {
return GeneralUtility::array_merge_recursive_overrule($array1, $array2);
}
}
示例8: initializeAction
/**
* @return void
*/
public function initializeAction()
{
$this->objects = $this->widgetConfiguration['objects'];
$this->configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($this->configuration, $this->widgetConfiguration['configuration'], TRUE);
$this->variables = $this->widgetConfiguration['variables'];
$objectsCount = 0;
foreach ($this->objects as $objects) {
$objectsCount += count($objects);
}
$this->numberOfPages = ceil($objectsCount / (int) $this->configuration['itemsPerPage']);
}
示例9: initializeAction
/**
* Initialize Action of the widget controller
*
* @return void
*/
public function initializeAction()
{
$this->objects = $this->widgetConfiguration['objects'];
if (version_compare(TYPO3_branch, '6.2', '<')) {
$this->configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($this->configuration, $this->widgetConfiguration['configuration'], TRUE);
} else {
if (version_compare(TYPO3_branch, '8.0', '<')) {
$this->configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($this->configuration, $this->widgetConfiguration['configuration'], TRUE);
} else {
$this->configuration = array_merge($this->configuration, $this->widgetConfiguration['configuration']);
}
}
}
示例10: initializeOverriddenSettings
/**
* @return void
*/
protected function initializeOverriddenSettings()
{
$row = $this->getRecord();
$flexFormData = $this->configurationService->convertFlexFormContentToArray($row['content_options']);
// rename key "settings" from fluidcontent_core
$flexFormData['content'] = $flexFormData['settings'];
unset($flexFormData['settings']);
if (class_exists('\\TYPO3\\CMS\\Core\\Utility\\ArrayUtility')) {
/** @noinspection PhpUndefinedClassInspection PhpUndefinedNamespaceInspection */
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->settings, $flexFormData);
} else {
/** @noinspection PhpDeprecationInspection */
$this->settings = GeneralUtility::array_merge_recursive_overrule($this->settings, $flexFormData);
}
#DebugUtility::debug( $this->settings, '$this->settings' );
parent::initializeOverriddenSettings();
}
示例11: loadTypoScriptFromFile
/**
* @param string $filePath
* @return void
*/
public static function loadTypoScriptFromFile($filePath)
{
static $typoScriptParser;
$filePath = GeneralUtility::getFileAbsFileName($filePath);
if ($filePath) {
if ($typoScriptParser === null) {
$typoScriptParser = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
}
/* @var \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser $typoScriptParser */
$typoScript = file_get_contents($filePath);
if ($typoScript) {
$typoScriptParser->parse($typoScript);
$typoScriptArray = $typoScriptParser->setup;
if (is_array($typoScriptArray) && !empty($typoScriptArray)) {
$GLOBALS['TSFE']->tmpl->setup = GeneralUtility::array_merge_recursive_overrule($typoScriptArray, $GLOBALS['TSFE']->tmpl->setup);
}
}
}
}
示例12: getParsedData
/**
* Returns parsed representation of XML file.
*
* @param string $sourcePath Source file path
* @param string $languageKey Language key
* @param string $charset Charset
* @return array
*/
public function getParsedData($sourcePath, $languageKey, $charset = '')
{
$this->sourcePath = $sourcePath;
$this->languageKey = $languageKey;
$this->charset = $this->getCharset($languageKey, $charset);
// Parse source
$parsedSource = $this->parseXmlFile();
// Parse target
$localizedTargetPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName(\TYPO3\CMS\Core\Utility\GeneralUtility::llXmlAutoFileName($this->sourcePath, $this->languageKey));
$targetPath = $this->languageKey !== 'default' && @is_file($localizedTargetPath) ? $localizedTargetPath : $this->sourcePath;
try {
$parsedTarget = $this->getParsedTargetData($targetPath);
} catch (\TYPO3\CMS\Core\Localization\Exception\InvalidXmlFileException $e) {
$parsedTarget = $this->getParsedTargetData($this->sourcePath);
}
$LOCAL_LANG = array();
$LOCAL_LANG[$languageKey] = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($parsedSource, $parsedTarget);
return $LOCAL_LANG;
}
示例13: prepareFixture
/**
* Prepare fixture
*
* @param array $configuration
* @param boolean $mockPermissionChecks
* @return void
*/
protected function prepareFixture($configuration, $mockPermissionChecks = FALSE, $driverObject = NULL, array $storageRecord = array())
{
$permissionMethods = array('isFileActionAllowed', 'isFolderActionAllowed', 'checkFileActionPermission', 'checkUserActionPermission');
$mockedMethods = NULL;
$configuration = $this->convertConfigurationArrayToFlexformXml($configuration);
$storageRecord = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($storageRecord, array('configuration' => $configuration));
if ($driverObject == NULL) {
/** @var $mockedDriver \TYPO3\CMS\Core\Resource\Driver\AbstractDriver */
$driverObject = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Resource\\Driver\\AbstractDriver', array(), '', FALSE);
}
if ($mockPermissionChecks) {
$mockedMethods = $permissionMethods;
}
if ($mockedMethods === NULL) {
$this->fixture = new \TYPO3\CMS\Core\Resource\ResourceStorage($driverObject, $storageRecord);
} else {
$this->fixture = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', $mockedMethods, array($driverObject, $storageRecord));
foreach ($permissionMethods as $method) {
$this->fixture->expects($this->any())->method($method)->will($this->returnValue(TRUE));
}
}
}
示例14: getConfigArray
/**
* Checks if config-array exists already but if not, gets it
*
* @return void
* @todo Define visibility
*/
public function getConfigArray()
{
$setStatPageName = FALSE;
// If config is not set by the cache (which would be a major mistake somewhere) OR if INTincScripts-include-scripts have been registered, then we must parse the template in order to get it
if (!is_array($this->config) || is_array($this->config['INTincScript']) || $this->forceTemplateParsing) {
$GLOBALS['TT']->push('Parse template', '');
// Force parsing, if set?:
$this->tmpl->forceTemplateParsing = $this->forceTemplateParsing;
// Start parsing the TS template. Might return cached version.
$this->tmpl->start($this->rootLine);
$GLOBALS['TT']->pull();
if ($this->tmpl->loaded) {
$GLOBALS['TT']->push('Setting the config-array', '');
// toplevel - objArrayName
$this->sPre = $this->tmpl->setup['types.'][$this->type];
$this->pSetup = $this->tmpl->setup[$this->sPre . '.'];
if (!is_array($this->pSetup)) {
$message = 'The page is not configured! [type=' . $this->type . '][' . $this->sPre . '].';
if ($this->checkPageUnavailableHandler()) {
$this->pageUnavailableAndExit($message);
} else {
$explanation = 'This means that there is no TypoScript object of type PAGE with typeNum=' . $this->type . ' configured.';
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'cms', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
throw new \TYPO3\CMS\Core\Error\Http\ServiceUnavailableException($message . ' ' . $explanation, 1294587217);
}
} else {
$this->config['config'] = array();
// Filling the config-array, first with the main "config." part
if (is_array($this->tmpl->setup['config.'])) {
$this->config['config'] = $this->tmpl->setup['config.'];
}
// override it with the page/type-specific "config."
if (is_array($this->pSetup['config.'])) {
$this->config['config'] = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($this->config['config'], $this->pSetup['config.']);
}
if ($this->config['config']['typolinkEnableLinksAcrossDomains']) {
$this->config['config']['typolinkCheckRootline'] = TRUE;
}
// Set default values for removeDefaultJS and inlineStyle2TempFile so CSS and JS are externalized if compatversion is higher than 4.0
if (\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version('4.0')) {
if (!isset($this->config['config']['removeDefaultJS'])) {
$this->config['config']['removeDefaultJS'] = 'external';
}
if (!isset($this->config['config']['inlineStyle2TempFile'])) {
$this->config['config']['inlineStyle2TempFile'] = 1;
}
}
if (!isset($this->config['config']['compressJs'])) {
$this->config['config']['compressJs'] = 0;
}
// Processing for the config_array:
$this->config['rootLine'] = $this->tmpl->rootLine;
$this->config['mainScript'] = trim($this->config['config']['mainScript']) ? trim($this->config['config']['mainScript']) : 'index.php';
// Class for render Header and Footer parts
$template = '';
if ($this->pSetup['pageHeaderFooterTemplateFile']) {
$file = $this->tmpl->getFileName($this->pSetup['pageHeaderFooterTemplateFile']);
if ($file) {
$this->setTemplateFile($file);
}
}
}
$GLOBALS['TT']->pull();
} else {
if ($this->checkPageUnavailableHandler()) {
$this->pageUnavailableAndExit('No TypoScript template found!');
} else {
$message = 'No TypoScript template found!';
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'cms', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
throw new \TYPO3\CMS\Core\Error\Http\ServiceUnavailableException($message, 1294587218);
}
}
}
// Initialize charset settings etc.
$this->initLLvars();
// No cache
// Set $this->no_cache TRUE if the config.no_cache value is set!
if ($this->config['config']['no_cache']) {
$this->set_no_cache();
}
// Merge GET with defaultGetVars
if (!empty($this->config['config']['defaultGetVars.'])) {
$modifiedGetVars = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule(\TYPO3\CMS\Core\Utility\GeneralUtility::removeDotsFromTS($this->config['config']['defaultGetVars.']), \TYPO3\CMS\Core\Utility\GeneralUtility::_GET());
\TYPO3\CMS\Core\Utility\GeneralUtility::_GETset($modifiedGetVars);
}
// Hook for postProcessing the configuration array
if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['configArrayPostProc'])) {
$params = array('config' => &$this->config['config']);
foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['configArrayPostProc'] as $funcRef) {
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
}
}
}
示例15: main_user
/**
* Rich Text Editor (RTE) user element selector
*
* @param [type] $openKeys: ...
* @return [type] ...
* @todo Define visibility
*/
public function main_user($openKeys)
{
// Starting content:
$content = $this->doc->startPage($GLOBALS['LANG']->getLL('Insert Custom Element', 1));
$RTEtsConfigParts = explode(':', \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('RTEtsConfigParams'));
$RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE', \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($RTEtsConfigParts[5]));
$thisConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::RTEsetup($RTEsetup['properties'], $RTEtsConfigParts[0], $RTEtsConfigParts[2], $RTEtsConfigParts[4]);
if (is_array($thisConfig['userElements.'])) {
$categories = array();
foreach ($thisConfig['userElements.'] as $k => $value) {
$ki = intval($k);
$v = $thisConfig['userElements.'][$ki . '.'];
if (substr($k, -1) == '.' && is_array($v)) {
$subcats = array();
$openK = $ki;
if ($openKeys[$openK]) {
$mArray = '';
switch ((string) $v['load']) {
case 'images_from_folder':
$mArray = array();
if ($v['path'] && @is_dir(PATH_site . $v['path'])) {
$files = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir(PATH_site . $v['path'], 'gif,jpg,jpeg,png', 0, '');
if (is_array($files)) {
$c = 0;
foreach ($files as $filename) {
$iInfo = @getimagesize(PATH_site . $v['path'] . $filename);
$iInfo = $this->calcWH($iInfo, 50, 100);
$ks = (string) (100 + $c);
$mArray[$ks] = $filename;
$mArray[$ks . '.'] = array('content' => '<img src="' . $this->siteUrl . $v['path'] . $filename . '" />', '_icon' => '<img src="' . $this->siteUrl . $v['path'] . $filename . '" ' . $iInfo[3] . ' />', 'description' => $GLOBALS['LANG']->getLL('filesize') . ': ' . str_replace(' ', ' ', \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(@filesize(PATH_site . $v['path'] . $filename))) . ', ' . $GLOBALS['LANG']->getLL('pixels', 1) . ': ' . $iInfo[0] . 'x' . $iInfo[1]);
$c++;
}
}
}
break;
}
if (is_array($mArray)) {
if ($v['merge']) {
$v = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($mArray, $v);
} else {
$v = $mArray;
}
}
foreach ($v as $k2 => $dummyValue) {
$k2i = intval($k2);
if (substr($k2, -1) == '.' && is_array($v[$k2i . '.'])) {
$title = trim($v[$k2i]);
if (!$title) {
$title = '[' . $GLOBALS['LANG']->getLL('noTitle', 1) . ']';
} else {
$title = $GLOBALS['LANG']->sL($title, 1);
}
$description = $GLOBALS['LANG']->sL($v[$k2i . '.']['description'], 1) . '<br />';
if (!$v[$k2i . '.']['dontInsertSiteUrl']) {
$v[$k2i . '.']['content'] = str_replace('###_URL###', $this->siteUrl, $v[$k2i . '.']['content']);
}
$logo = $v[$k2i . '.']['_icon'] ? $v[$k2i . '.']['_icon'] : '';
$onClickEvent = '';
switch ((string) $v[$k2i . '.']['mode']) {
case 'wrap':
$wrap = explode('|', $v[$k2i . '.']['content']);
$onClickEvent = 'wrapHTML(' . $GLOBALS['LANG']->JScharCode($wrap[0]) . ',' . $GLOBALS['LANG']->JScharCode($wrap[1]) . ',false);';
break;
case 'processor':
$script = trim($v[$k2i . '.']['submitToScript']);
if (substr($script, 0, 4) != 'http') {
$script = $this->siteUrl . $script;
}
if ($script) {
$onClickEvent = 'processSelection(' . $GLOBALS['LANG']->JScharCode($script) . ');';
}
break;
case 'insert':
default:
$onClickEvent = 'insertHTML(' . $GLOBALS['LANG']->JScharCode($v[$k2i . '.']['content']) . ');';
break;
}
$A = array('<a href="#" onClick="' . $onClickEvent . 'return false;">', '</a>');
$subcats[$k2i] = '<tr>
<td><img src="clear.gif" width="18" height="1" /></td>
<td class="bgColor4" valign="top">' . $A[0] . $logo . $A[1] . '</td>
<td class="bgColor4" valign="top">' . $A[0] . '<strong>' . $title . '</strong><br />' . $description . $A[1] . '</td>
</tr>';
}
}
ksort($subcats);
}
$categories[$ki] = implode('', $subcats);
}
}
ksort($categories);
// Render menu of the items:
$lines = array();
//.........这里部分代码省略.........