示例#1
0
 /**
  * @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);
 }
 /**
  * @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;
 }
 /**
  * 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 . '/';
 }
 /**
  * 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;
 }
 /**
  * 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)));
 }
 /**
  * Implements array_merge_recursive_overrule() in a cross-version way
  * This code is a copy from realurl, written by Dmitry Dulepov <*****@*****.**>.
  *
  * @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;
 }
 /**
  * @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);
     }
 }
 /**
  * @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']);
 }
 /**
  * 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']);
         }
     }
 }
 /**
  * @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();
 }
 /**
  * @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
0
 /**
  * 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;
 }
 /**
  * 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));
         }
     }
 }
 /**
  * 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
0
    /**
     * 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('&nbsp;', ' ', \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();
            foreach ($categories as $k => $v) {
                $title = trim($thisConfig['userElements.'][$k]);
                $openK = $k;
                if (!$title) {
                    $title = '[' . $GLOBALS['LANG']->getLL('noTitle', 1) . ']';
                } else {
                    $title = $GLOBALS['LANG']->sL($title, 1);
                }
                $lines[] = '<tr><td colspan="3" class="bgColor5"><a href="#" title="' . $GLOBALS['LANG']->getLL('expand', 1) . '" onClick="jumpToUrl(\'?OC_key=' . ($openKeys[$openK] ? 'C|' : 'O|') . $openK . '\');return false;"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/' . ($openKeys[$openK] ? 'minus' : 'plus') . 'bullet.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('expand', 1) . '" /><strong>' . $title . '</strong></a></td></tr>';
                $lines[] = $v;
            }
            $content .= '<table border="0" cellpadding="1" cellspacing="1">' . implode('', $lines) . '</table>';
        }
        $content .= $this->doc->endPage();
        return $content;
    }
示例#16
0
 /**
  * @param array $row
  * @return Form|NULL
  */
 public function getForm(array $row)
 {
     if (NULL !== $this->form) {
         return $this->form;
     }
     $formClassName = $this->resolveFormClassName($row);
     if (NULL !== $formClassName) {
         $form = call_user_func_array(array($formClassName, 'create'), array($row));
     } else {
         $templateSource = $this->getTemplateSource($row);
         if (NULL === $templateSource) {
             // Early return: no template file, no source - NULL expected.
             return NULL;
         }
         $section = $this->getConfigurationSectionName($row);
         $controllerName = 'Flux';
         $formName = 'form';
         $paths = $this->getTemplatePaths($row);
         $extensionKey = $this->getExtensionKey($row);
         $extensionName = ExtensionNamingUtility::getExtensionName($extensionKey);
         $fieldName = $this->getFieldName($row);
         $typoScript = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
         $signature = str_replace('_', '', $extensionKey);
         $variables = array('record' => $row);
         if (TRUE === isset($typoScript['plugin.']['tx_' . $signature . '.']['settings.'])) {
             $variables['settings'] = GeneralUtility::removeDotsFromTS($typoScript['plugin.']['tx_' . $signature . '.']['settings.']);
         }
         // Special case: when saving a new record variable $row[$fieldName] is already an array
         // and must not be processed by the configuration service.
         if (FALSE === is_array($row[$fieldName])) {
             $recordVariables = $this->configurationService->convertFlexFormContentToArray($row[$fieldName]);
             $variables = GeneralUtility::array_merge_recursive_overrule($variables, $recordVariables);
         }
         $variables = GeneralUtility::array_merge_recursive_overrule($this->templateVariables, $variables);
         $view = $this->configurationService->getPreparedExposedTemplateView($extensionName, $controllerName, $paths, $variables);
         $view->setTemplateSource($templateSource);
         $form = $view->getForm($section, $formName);
     }
     $form = $this->setDefaultValuesInFieldsWithInheritedValues($form, $row);
     return $form;
 }
示例#17
0
 /**
  * Returns the settings used by this particular Asset
  * during inclusion. Public access allows later inspection
  * of the TypoScript values which were applied to the Asset.
  *
  * @return array
  */
 public function getSettings()
 {
     if (NULL === self::$settingsCache) {
         $allTypoScript = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
         $settingsExist = isset($allTypoScript['plugin.']['tx_vhs.']['settings.']);
         if (FALSE === $settingsExist) {
             // no settings exist, but don't allow a NULL value. This prevents cache clobbering.
             self::$settingsCache = array();
         } else {
             self::$settingsCache = GeneralUtility::removeDotsFromTS($allTypoScript['plugin.']['tx_vhs.']['settings.']);
         }
     }
     $settings = self::$settingsCache;
     if (TRUE === is_array($this->localSettings)) {
         if (TRUE === method_exists('TYPO3\\CMS\\Core\\Utility\\ArrayUtility', 'mergeRecursiveWithOverrule')) {
             ArrayUtility::mergeRecursiveWithOverrule($settings, $this->localSettings);
         } else {
             $settings = GeneralUtility::array_merge_recursive_overrule($settings, $this->localSettings);
         }
     }
     return $settings;
 }
 /**
  * Get current configuration of an extension
  *
  * @param string $extensionKey
  * @return array
  */
 public function getCurrentConfiguration($extensionKey)
 {
     $extension = $GLOBALS['TYPO3_LOADED_EXT'][$extensionKey];
     $defaultConfig = $this->configurationItemRepository->createArrayFromConstants(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(PATH_site . $extension['siteRelPath'] . '/ext_conf_template.txt'), $extension);
     $currentExtensionConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extension['key']]);
     $currentExtensionConfig = is_array($currentExtensionConfig) ? $currentExtensionConfig : array();
     $currentFullConfiguration = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($defaultConfig, $currentExtensionConfig);
     return $currentFullConfiguration;
 }
 protected function initializeSettings()
 {
     if (isset($this->settings['override'])) {
         // this will override values if they are not empty and they already exist (so no adding of keys)
         $this->settings = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($this->settings, $this->settings['override'], true, false);
     }
 }
 /**
  * The constructor of this class
  *
  * @param string $table The table to query
  * @param array $config The configuration (TCA overlayed with TSconfig) to use for this selector
  * @return void
  */
 public function __construct($table, $config)
 {
     $this->table = $table;
     $this->config = $config;
     // get a list of all the pages that should be looked on
     if (isset($config['pidList'])) {
         $allowedPages = $pageIds = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $config['pidList']);
         $depth = intval($config['pidDepth']);
         foreach ($pageIds as $pageId) {
             if ($pageId > 0) {
                 $allowedPages = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($allowedPages, $this->getAllSubpagesOfPage($pageId, $depth));
             }
         }
         $this->allowedPages = array_unique($allowedPages);
     }
     if (isset($config['maxItemsInResultList'])) {
         $this->maxItems = $config['maxItemsInResultList'];
     }
     if ($this->table == 'pages') {
         $this->addWhere = ' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1);
     }
     // if table is versionized, only get the records from the Live Workspace
     // the overlay itself of WS-records is done below
     if ($GLOBALS['TCA'][$this->table]['ctrl']['versioningWS'] == TRUE) {
         $this->addWhere .= ' AND t3ver_wsid = 0';
     }
     if (isset($config['addWhere'])) {
         $this->addWhere .= ' ' . $config['addWhere'];
     }
 }
 /**
  * Including any locallang file configured and merging its content over the current global LOCAL_LANG array (which is EXPECTED to exist!!!)
  *
  * @return void
  * @todo Define visibility
  */
 public function incLocalLang()
 {
     if ($this->localLangFile && (@is_file($this->thisPath . '/' . $this->localLangFile) || @is_file($this->thisPath . '/' . substr($this->localLangFile, 0, -4) . '.xml') || @is_file($this->thisPath . '/' . substr($this->localLangFile, 0, -4) . '.xlf'))) {
         $LOCAL_LANG = $GLOBALS['LANG']->includeLLFile($this->thisPath . '/' . $this->localLangFile, FALSE);
         if (is_array($LOCAL_LANG)) {
             $GLOBALS['LOCAL_LANG'] = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule((array) $GLOBALS['LOCAL_LANG'], $LOCAL_LANG);
         }
     }
 }
示例#22
0
 /**
  * Returns an instance of a tree select filter
  *
  * @var array $additionalSettings
  * @return Tx_PtExtlist_Domain_Model_Filter_TreeSelectFilter
  */
 protected function getTreeSelectFilter($additionalSettings = array())
 {
     $settings = array('filterIdentifier' => 'treeSelectFilter1', 'filterClassName' => 'Tx_PtExtlist_Domain_Model_Filter_TreeSelectFilter', 'fieldIdentifier' => 'field1', 'partialPath' => 'doesNotMatter');
     $settings = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($settings, $additionalSettings);
     $accessibleFilterClass = $this->buildAccessibleProxy('Tx_PtExtlist_Domain_Model_Filter_TreeSelectFilter');
     $filter = new $accessibleFilterClass();
     /** @var Tx_PtExtlist_Domain_Model_Filter_StringFilter $filter */
     $filter->_injectFilterConfig(new Tx_PtExtlist_Domain_Configuration_Filters_FilterConfig($this->configurationBuilderMock, $settings, 'test'));
     $gpVarAdapterMock = $this->getMock('Tx_PtExtbase_State_GpVars_GpVarsAdapter', array('injectParametersInObject'), array(), '', false);
     // TODO why is this method called more than once?!?
     $gpVarAdapterMock->expects($this->any())->method('injectParametersInObject');
     $fieldConfigMock = $this->getMock('Tx_PtExtlist_Domain_Configuration_Data_Fields_FieldConfig', array('getTable', 'getField'), array($this->configurationBuilderMock, 'testfield', array('field' => 'testfield', 'table' => 'testtable')));
     $fieldConfigMock->expects($this->any())->method('getTable')->will($this->returnValue('testtable'));
     $fieldConfigMock->expects($this->any())->method('getField')->will($this->returnValue('testfield'));
     $fieldConfigCollectionMock = $this->getMock('Tx_PtExtlist_Domain_Configuration_Data_Fields_FieldConfigCollection', array('getFieldConfigByIdentifier'));
     $fieldConfigCollectionMock->expects($this->any())->method('getFieldConfigByIdentifier')->will($this->returnValue($fieldConfigMock));
     $dataBackendMock = $this->getMock('Tx_PtExtlist_Domain_DataBackend_MySqlDataBackend_MySqlDataBackend', array('getFieldConfigurationCollection'), array($this->configurationBuilderMock));
     $dataBackendMock->expects($this->any())->method('getFieldConfigurationCollection')->will($this->returnValue($fieldConfigCollectionMock));
     $filter->_injectDataBackend($dataBackendMock);
     $filter->_injectGpVarsAdapter($gpVarAdapterMock);
     return $filter;
 }
示例#23
0
 /**
  * Link a string to the current page while keeping currently set values in piVars.
  * Like pi_linkTP, but $urlParameters is by default set to $this->piVars with $overrulePIvars overlaid.
  * This means any current entries from this->piVars are passed on (except the key "DATA" which will be unset before!) and entries in $overrulePIvars will OVERRULE the current in the link.
  *
  * @param string $str The content string to wrap in <a> tags
  * @param array $overrulePIvars Array of values to override in the current piVars. Contrary to pi_linkTP the keys in this array must correspond to the real piVars array and therefore NOT be prefixed with the $this->prefixId string. Further, if a value is a blank string it means the piVar key will not be a part of the link (unset)
  * @param boolean $cache If $cache is set, the page is asked to be cached by a &cHash value (unless the current plugin using this class is a USER_INT). Otherwise the no_cache-parameter will be a part of the link.
  * @param boolean $clearAnyway If set, then the current values of piVars will NOT be preserved anyways... Practical if you want an easy way to set piVars without having to worry about the prefix, "tx_xxxxx[]
  * @param integer $altPageId Alternative page ID for the link. (By default this function links to the SAME page!)
  * @return string The input string wrapped in <a> tags
  * @see pi_linkTP()
  * @todo Define visibility
  */
 public function pi_linkTP_keepPIvars($str, $overrulePIvars = array(), $cache = 0, $clearAnyway = 0, $altPageId = 0)
 {
     if (is_array($this->piVars) && is_array($overrulePIvars) && !$clearAnyway) {
         $piVars = $this->piVars;
         unset($piVars['DATA']);
         $overrulePIvars = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($piVars, $overrulePIvars);
         if ($this->pi_autoCacheEn) {
             $cache = $this->pi_autoCache($overrulePIvars);
         }
     }
     $res = $this->pi_linkTP($str, array($this->prefixId => $overrulePIvars), $cache, $altPageId);
     return $res;
 }
 /**
  * Merges 2 configuration arrays
  *
  * @param array The base settings
  * @param array The settings overriding the base settings.
  * @return array The merged settings
  */
 public function mergeConfiguration($settings, $newSettings)
 {
     return \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($settings, $newSettings);
 }
示例#25
0
文件: Asset.php 项目: fluidtypo3/vhs
 /**
  * Returns the settings used by this particular Asset
  * during inclusion. Public access allows later inspection
  * of the TypoScript values which were applied to the Asset.
  *
  * @return array
  */
 public function getSettings()
 {
     if (null === self::$settingsCache) {
         $allTypoScript = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
         $settingsExist = isset($allTypoScript['plugin.']['tx_vhs.']['settings.']);
         if (true === $settingsExist) {
             self::$settingsCache = GeneralUtility::removeDotsFromTS($allTypoScript['plugin.']['tx_vhs.']['settings.']);
         }
     }
     $settings = (array) self::$settingsCache;
     $properties = get_class_vars(get_class($this));
     foreach (array_keys($properties) as $propertyName) {
         $properties[$propertyName] = $this->{$propertyName};
     }
     if (true === method_exists('TYPO3\\CMS\\Core\\Utility\\ArrayUtility', 'mergeRecursiveWithOverrule')) {
         ArrayUtility::mergeRecursiveWithOverrule($settings, $this->settings);
         ArrayUtility::mergeRecursiveWithOverrule($settings, $properties);
     } else {
         $settings = GeneralUtility::array_merge_recursive_overrule($settings, $this->settings);
         $settings = GeneralUtility::array_merge_recursive_overrule($settings, $properties);
     }
     return $settings;
 }
    /**
     * Return a form to add a new task or edit an existing one
     *
     * @return 	string	HTML form to add or edit a task
     */
    protected function editTask()
    {
        $registeredClasses = self::getRegisteredClasses();
        $content = '';
        $taskInfo = array();
        $task = NULL;
        $process = 'edit';
        if ($this->submittedData['uid'] > 0) {
            // If editing, retrieve data for existing task
            try {
                $taskRecord = $this->scheduler->fetchTaskRecord($this->submittedData['uid']);
                // If there's a registered execution, the task should not be edited
                if (!empty($taskRecord['serialized_executions'])) {
                    $this->addMessage($GLOBALS['LANG']->getLL('msg.maynotEditRunningTask'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                    throw new \LogicException('Runnings tasks cannot not be edited', 1251232849);
                }
                // Get the task object
                /** @var $task \TYPO3\CMS\Scheduler\Task */
                $task = unserialize($taskRecord['serialized_task_object']);
                // Set some task information
                $class = $taskRecord['classname'];
                $taskInfo['disable'] = $taskRecord['disable'];
                // Check that the task object is valid
                if ($this->scheduler->isValidTaskObject($task)) {
                    // The task object is valid, process with fetching current data
                    $taskInfo['class'] = $class;
                    // Get execution information
                    $taskInfo['start'] = $task->getExecution()->getStart();
                    $taskInfo['end'] = $task->getExecution()->getEnd();
                    $taskInfo['interval'] = $task->getExecution()->getInterval();
                    $taskInfo['croncmd'] = $task->getExecution()->getCronCmd();
                    $taskInfo['multiple'] = $task->getExecution()->getMultiple();
                    if (!empty($taskInfo['interval']) || !empty($taskInfo['croncmd'])) {
                        // Guess task type from the existing information
                        // If an interval or a cron command is defined, it's a recurring task
                        // FIXME: remove magic numbers for the type, use class constants instead
                        $taskInfo['type'] = 2;
                        $taskInfo['frequency'] = empty($taskInfo['interval']) ? $taskInfo['croncmd'] : $taskInfo['interval'];
                    } else {
                        // It's not a recurring task
                        // Make sure interval and cron command are both empty
                        $taskInfo['type'] = 1;
                        $taskInfo['frequency'] = '';
                        $taskInfo['end'] = 0;
                    }
                } else {
                    // The task object is not valid
                    // Issue error message
                    $this->addMessage(sprintf($GLOBALS['LANG']->getLL('msg.invalidTaskClassEdit'), $class), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                    // Initialize empty values
                    $taskInfo['start'] = 0;
                    $taskInfo['end'] = 0;
                    $taskInfo['frequency'] = '';
                    $taskInfo['multiple'] = FALSE;
                    $taskInfo['type'] = 1;
                }
            } catch (\OutOfBoundsException $e) {
                // Add a message and continue throwing the exception
                $this->addMessage(sprintf($GLOBALS['LANG']->getLL('msg.taskNotFound'), $this->submittedData['uid']), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                throw $e;
            }
        } else {
            // If adding a new object, set some default values
            $taskInfo['class'] = key($registeredClasses);
            $taskInfo['type'] = 2;
            $taskInfo['start'] = $GLOBALS['EXEC_TIME'];
            $taskInfo['end'] = '';
            $taskInfo['frequency'] = '';
            $taskInfo['multiple'] = 0;
            $process = 'add';
        }
        if (count($this->submittedData) > 0) {
            // If some data was already submitted, use it to override
            // existing data
            $taskInfo = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($taskInfo, $this->submittedData);
        }
        // Get the extra fields to display for each task that needs some
        $allAdditionalFields = array();
        if ($process == 'add') {
            foreach ($registeredClasses as $class => $registrationInfo) {
                if (!empty($registrationInfo['provider'])) {
                    /** @var $providerObject \TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface */
                    $providerObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($registrationInfo['provider']);
                    if ($providerObject instanceof \TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface) {
                        $additionalFields = $providerObject->getAdditionalFields($taskInfo, NULL, $this);
                        $allAdditionalFields = array_merge($allAdditionalFields, array($class => $additionalFields));
                    }
                }
            }
        } else {
            if (!empty($registeredClasses[$taskInfo['class']]['provider'])) {
                $providerObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($registeredClasses[$taskInfo['class']]['provider']);
                if ($providerObject instanceof \TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface) {
                    $allAdditionalFields[$taskInfo['class']] = $providerObject->getAdditionalFields($taskInfo, $task, $this);
                }
            }
        }
        // Load necessary JavaScript
        /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
        $pageRenderer = $this->doc->getPageRenderer();
        $pageRenderer->loadExtJS();
        $pageRenderer->addJsFile(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('scheduler') . 'res/tx_scheduler_be.js');
        $pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/tceforms.js');
        $pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/ux/Ext.ux.DateTimePicker.js');
        // Define settings for Date Picker
        $typo3Settings = array('datePickerUSmode' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? 1 : 0, 'dateFormat' => array('j-n-Y', 'G:i j-n-Y'), 'dateFormatUS' => array('n-j-Y', 'G:i n-j-Y'));
        $pageRenderer->addInlineSettingArray('', $typo3Settings);
        // Define table layout for add/edit form
        $tableLayout = array('table' => array('<table border="0" cellspacing="0" cellpadding="0" id="edit_form" class="typo3-usersettings">', '</table>'));
        // Define a style for hiding
        // Some fields will be hidden when the task is not recurring
        $style = '';
        if ($taskInfo['type'] == 1) {
            $style = ' style="display: none"';
        }
        // Start rendering the add/edit form
        $content .= '<input type="hidden" name="tx_scheduler[uid]" value="' . $this->submittedData['uid'] . '" />';
        $content .= '<input type="hidden" name="previousCMD" value="' . $this->CMD . '" />';
        $content .= '<input type="hidden" name="CMD" value="save" />';
        $table = array();
        $tr = 0;
        $defaultCell = array('<td class="td-input">', '</td>');
        // Disable checkbox
        $label = '<label for="task_disable">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:disable') . '</label>';
        $table[$tr][] = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($this->cshKey, 'task_disable', $label);
        $table[$tr][] = '<input type="hidden"   name="tx_scheduler[disable]" value="0" />
			 <input type="checkbox" name="tx_scheduler[disable]" value="1" id="task_disable"' . ($taskInfo['disable'] == 1 ? ' checked="checked"' : '') . ' />';
        $tableLayout[$tr] = array('tr' => array('<tr id="task_disable_row">', '</tr>'), 'defCol' => $defaultCell, '0' => array('<td class="td-label">', '</td>'));
        $tr++;
        // Task class selector
        $label = '<label for="task_class">' . $GLOBALS['LANG']->getLL('label.class') . '</label>';
        $table[$tr][] = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($this->cshKey, 'task_class', $label);
        // On editing, don't allow changing of the task class, unless it was not valid
        if ($this->submittedData['uid'] > 0 && !empty($taskInfo['class'])) {
            $cell = $registeredClasses[$taskInfo['class']]['title'] . ' (' . $registeredClasses[$taskInfo['class']]['extension'] . ')';
            $cell .= '<input type="hidden" name="tx_scheduler[class]" id="task_class" value="' . $taskInfo['class'] . '" />';
        } else {
            $cell = '<select name="tx_scheduler[class]" id="task_class" class="wide" onchange="actOnChangedTaskClass(this)">';
            // Group registered classes by classname
            $groupedClasses = array();
            foreach ($registeredClasses as $class => $classInfo) {
                $groupedClasses[$classInfo['extension']][$class] = $classInfo;
            }
            ksort($groupedClasses);
            // Loop on all grouped classes to display a selector
            foreach ($groupedClasses as $extension => $class) {
                $cell .= '<optgroup label="' . $extension . '">';
                foreach ($groupedClasses[$extension] as $class => $classInfo) {
                    $selected = $class == $taskInfo['class'] ? ' selected="selected"' : '';
                    $cell .= '<option value="' . $class . '"' . 'title="' . $classInfo['description'] . '"' . $selected . '>' . $classInfo['title'] . '</option>';
                }
                $cell .= '</optgroup>';
            }
            $cell .= '</select>';
        }
        $table[$tr][] = $cell;
        // Make sure each row has a unique id, for manipulation with JS
        $tableLayout[$tr] = array('tr' => array('<tr id="task_class_row">', '</tr>'), 'defCol' => $defaultCell, '0' => array('<td class="td-label">', '</td>'));
        $tr++;
        // Task type selector
        $label = '<label for="task_type">' . $GLOBALS['LANG']->getLL('label.type') . '</label>';
        $table[$tr][] = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($this->cshKey, 'task_type', $label);
        $table[$tr][] = '<select name="tx_scheduler[type]" id="task_type" onchange="actOnChangedTaskType(this)">' . '<option value="1"' . ($taskInfo['type'] == 1 ? ' selected="selected"' : '') . '>' . $GLOBALS['LANG']->getLL('label.type.single') . '</option>' . '<option value="2"' . ($taskInfo['type'] == 2 ? ' selected="selected"' : '') . '>' . $GLOBALS['LANG']->getLL('label.type.recurring') . '</option>' . '</select>';
        $tableLayout[$tr] = array('tr' => array('<tr id="task_type_row">', '</tr>'), 'defCol' => $defaultCell, '0' => array('<td class="td-label">', '</td>'));
        $tr++;
        // Start date/time field
        // NOTE: datetime fields need a special id naming scheme
        $label = '<label for="tceforms-datetimefield-task_start">' . $GLOBALS['LANG']->getLL('label.start') . '</label>';
        $table[$tr][] = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($this->cshKey, 'task_start', $label);
        $table[$tr][] = '<input name="tx_scheduler[start]" type="text" id="tceforms-datetimefield-task_start" value="' . (empty($taskInfo['start']) ? '' : strftime('%H:%M %d-%m-%Y', $taskInfo['start'])) . '" />' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-pick-date', array('style' => 'cursor:pointer;', 'id' => 'picker-tceforms-datetimefield-task_start'));
        $tableLayout[$tr] = array('tr' => array('<tr id="task_start_row">', '</tr>'), 'defCol' => $defaultCell, '0' => array('<td class="td-label">', '</td>'));
        $tr++;
        // End date/time field
        // NOTE: datetime fields need a special id naming scheme
        $label = '<label for="tceforms-datetimefield-task_end">' . $GLOBALS['LANG']->getLL('label.end') . '</label>';
        $table[$tr][] = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($this->cshKey, 'task_end', $label);
        $table[$tr][] = '<input name="tx_scheduler[end]" type="text" id="tceforms-datetimefield-task_end" value="' . (empty($taskInfo['end']) ? '' : strftime('%H:%M %d-%m-%Y', $taskInfo['end'])) . '" />' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-pick-date', array('style' => 'cursor:pointer;', 'id' => 'picker-tceforms-datetimefield-task_end'));
        $tableLayout[$tr] = array('tr' => array('<tr id="task_end_row"' . $style . '>', '</tr>'), 'defCol' => $defaultCell, '0' => array('<td class="td-label">', '</td>'));
        $tr++;
        // Frequency input field
        $label = '<label for="task_frequency">' . $GLOBALS['LANG']->getLL('label.frequency.long') . '</label>';
        $table[$tr][] = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($this->cshKey, 'task_frequency', $label);
        $cell = '<input type="text" name="tx_scheduler[frequency]" id="task_frequency" value="' . htmlspecialchars($taskInfo['frequency']) . '" />';
        $table[$tr][] = $cell;
        $tableLayout[$tr] = array('tr' => array('<tr id="task_frequency_row"' . $style . '>', '</tr>'), 'defCol' => $defaultCell, '0' => array('<td class="td-label">', '</td>'));
        $tr++;
        // Multiple execution selector
        $label = '<label for="task_multiple">' . $GLOBALS['LANG']->getLL('label.parallel.long') . '</label>';
        $table[$tr][] = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($this->cshKey, 'task_multiple', $label);
        $table[$tr][] = '<input type="hidden"   name="tx_scheduler[multiple]" value="0" />
			 <input type="checkbox" name="tx_scheduler[multiple]" value="1" id="task_multiple"' . ($taskInfo['multiple'] == 1 ? ' checked="checked"' : '') . ' />';
        $tableLayout[$tr] = array('tr' => array('<tr id="task_multiple_row"' . $style . '>', '</tr>'), 'defCol' => $defaultCell, '0' => array('<td class="td-label">', '</td>'));
        $tr++;
        // Display additional fields
        foreach ($allAdditionalFields as $class => $fields) {
            if ($class == $taskInfo['class']) {
                $additionalFieldsStyle = '';
            } else {
                $additionalFieldsStyle = ' style="display: none"';
            }
            // Add each field to the display, if there are indeed any
            if (isset($fields) && is_array($fields)) {
                foreach ($fields as $fieldID => $fieldInfo) {
                    $label = '<label for="' . $fieldID . '">' . $GLOBALS['LANG']->sL($fieldInfo['label']) . '</label>';
                    $table[$tr][] = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($fieldInfo['cshKey'], $fieldInfo['cshLabel'], $label);
                    $table[$tr][] = $fieldInfo['code'];
                    $tableLayout[$tr] = array('tr' => array('<tr id="' . $fieldID . '_row"' . $additionalFieldsStyle . ' class="extraFields extra_fields_' . $class . '">', '</tr>'), 'defCol' => $defaultCell, '0' => array('<td class="td-label">', '</td>'));
                    $tr++;
                }
            }
        }
        // Render the add/edit task form
        $content .= '<div style="float: left;"><div class="typo3-dyntabmenu-divs">';
        $content .= $this->doc->table($table, $tableLayout);
        $content .= '</div></div>';
        $content .= '<div style="padding-top: 20px; clear: both;"></div>';
        // Display information about server time usage
        $content .= $this->displayServerTime();
        return $content;
    }
 /**
  * Reads the configuration array and exports it to the global variable
  *
  * @access private
  * @return void
  */
 public function exportConfiguration()
 {
     if (@is_file($this->getLocalConfigurationFileResource())) {
         $localConfiguration = $this->getLocalConfiguration();
         if (is_array($localConfiguration)) {
             $GLOBALS['TYPO3_CONF_VARS'] = Utility\GeneralUtility::array_merge_recursive_overrule($this->getDefaultConfiguration(), $localConfiguration);
         } else {
             throw new \UnexpectedValueException('LocalConfiguration invalid.', 1349272276);
         }
         if (@is_file(PATH_site . self::ADDITIONAL_CONFIGURATION_FILE)) {
             require PATH_site . self::ADDITIONAL_CONFIGURATION_FILE;
         }
         // @deprecated since 6.0: Simulate old 'extList' as comma separated list of 'extListArray'
         $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = implode(',', $GLOBALS['TYPO3_CONF_VARS']['EXT']['extListArray']);
     } elseif (@is_file(PATH_site . self::LOCALCONF_FILE)) {
         $GLOBALS['TYPO3_CONF_VARS'] = $this->getDefaultConfiguration();
         // Legacy localconf.php handling
         // @deprecated: Can be removed if old localconf.php is not supported anymore
         global $TYPO3_CONF_VARS, $typo_db, $typo_db_username, $typo_db_password, $typo_db_host, $typo_db_extTableDef_script;
         require PATH_site . self::LOCALCONF_FILE;
         // If the localconf.php was not upgraded to LocalConfiguration.php, the default extListArray
         // from t3lib/stddb/DefaultConfiguration.php is still set. In this case we just unset
         // this key here, so t3lib_extMgm::getLoadedExtensionListArray() falls back to use extList string
         // @deprecated: This case can be removed later if localconf.php is not supported anymore
         unset($TYPO3_CONF_VARS['EXT']['extListArray']);
         // Write the old globals into the new place in the configuration array
         $GLOBALS['TYPO3_CONF_VARS']['DB'] = array();
         $GLOBALS['TYPO3_CONF_VARS']['DB']['database'] = $typo_db;
         $GLOBALS['TYPO3_CONF_VARS']['DB']['username'] = $typo_db_username;
         $GLOBALS['TYPO3_CONF_VARS']['DB']['password'] = $typo_db_password;
         $GLOBALS['TYPO3_CONF_VARS']['DB']['host'] = $typo_db_host;
         $GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript'] = $typo_db_extTableDef_script;
         unset($GLOBALS['typo_db']);
         unset($GLOBALS['typo_db_username']);
         unset($GLOBALS['typo_db_password']);
         unset($GLOBALS['typo_db_host']);
         unset($GLOBALS['typo_db_extTableDef_script']);
     } else {
         throw new \RuntimeException('Neither ' . self::LOCAL_CONFIGURATION_FILE . ' (recommended) nor ' . self::LOCALCONF_FILE . ' (obsolete) could be found!', 1349272337);
     }
 }
示例#28
0
 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
 * XHTML compatible.
 *
 * @author Kasper Skårhøj <*****@*****.**>
 */
unset($MCONF);
require 'conf.php';
require $BACK_PATH . 'init.php';
// Unset MCONF/MLANG since all we wanted was back path etc. for this particular script.
unset($MCONF);
unset($MLANG);
// Merging locallang files/arrays:
$GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
$LOCAL_LANG_orig = $LOCAL_LANG;
$LANG->includeLLFile('EXT:cms/layout/locallang_db_new_content_el.xml');
$LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($LOCAL_LANG_orig, $LOCAL_LANG);
// Exits if 'cms' extension is not loaded:
\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms', 1);
/**
 * Local position map class
 *
 * @author Kasper Skårhøj <*****@*****.**>
 * @package TYPO3
 * @subpackage core
 */
class ext_posMap extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap
{
    /**
     * @todo Define visibility
     */
    public $dontPrintPageInsertIcons = 1;
 /**
  * @test
  */
 public function arrayMergeRecursiveOverruleDoesConsiderUnsetValues()
 {
     $array1 = array('first' => array('second' => 'second', 'third' => 'third'));
     $array2 = array('first' => array('second' => 'overrule', 'third' => '__UNSET', 'fourth' => 'overrile'));
     $expected = array('first' => array('second' => 'overrule', 'fourth' => 'overrile'));
     $result = Utility\GeneralUtility::array_merge_recursive_overrule($array1, $array2);
     $this->assertEquals($expected, $result);
 }
示例#30
0
 /**
  * Returns overlayered RTE setup from an array with TSconfig. Used in TCEforms and TCEmain
  *
  * @param array $RTEprop The properties of Page TSconfig in the key "RTE.
  * @param string $table Table name
  * @param string $field Field name
  * @param string $type Type value of the current record (like from CType of tt_content)
  * @return array Array with the configuration for the RTE
  * @internal
  */
 public static function RTEsetup($RTEprop, $table, $field, $type = '')
 {
     $thisConfig = is_array($RTEprop['default.']) ? $RTEprop['default.'] : array();
     $thisFieldConf = $RTEprop['config.'][$table . '.'][$field . '.'];
     if (is_array($thisFieldConf)) {
         unset($thisFieldConf['types.']);
         $thisConfig = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($thisConfig, $thisFieldConf);
     }
     if ($type && is_array($RTEprop['config.'][$table . '.'][$field . '.']['types.'][$type . '.'])) {
         $thisConfig = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($thisConfig, $RTEprop['config.'][$table . '.'][$field . '.']['types.'][$type . '.']);
     }
     return $thisConfig;
 }