作者:rickymathe
项目:TYPO3.CM
/**
* Set the options for this object
*
* @param array $parameters Configuration array
* @return void
*/
protected function setOptions(array $parameters)
{
if (is_array($parameters)) {
$keys = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($parameters);
foreach ($keys as $key) {
$class = $parameters[$key];
if ((int) $key && strpos($key, '.') === false) {
if (isset($parameters[$key . '.']) && $class === 'OPTION') {
$childElementArguments = $parameters[$key . '.'];
if (isset($childElementArguments['selected'])) {
$childElementArguments['attributes']['selected'] = $childElementArguments['selected'];
unset($childElementArguments['selected']);
}
if (isset($childElementArguments['value'])) {
$childElementArguments['attributes']['value'] = $childElementArguments['value'];
unset($childElementArguments['value']);
}
if (isset($childElementArguments['data']) && !isset($childElementArguments['text'])) {
// preserve backward compatibility by rewriting data to text
$childElementArguments['text'] = $childElementArguments['data'];
}
$this->configuration['options'][] = $childElementArguments;
}
}
}
}
}
作者:rickymathe
项目:TYPO3.CM
/**
* The main method called by the controller
*
* Iterates over the configured post processors and calls them with their
* own settings
*
* @return string HTML messages from the called processors
*/
public function process()
{
$html = '';
if (is_array($this->postProcessorTypoScript)) {
$keys = TemplateService::sortedKeyList($this->postProcessorTypoScript);
foreach ($keys as $key) {
if (!(int) $key || strpos($key, '.') !== false) {
continue;
}
$className = false;
$processorName = $this->postProcessorTypoScript[$key];
$processorArguments = array();
if (isset($this->postProcessorTypoScript[$key . '.'])) {
$processorArguments = $this->postProcessorTypoScript[$key . '.'];
}
if (class_exists($processorName, true)) {
$className = $processorName;
} else {
$classNameExpanded = 'TYPO3\\CMS\\Form\\PostProcess\\' . ucfirst(strtolower($processorName)) . 'PostProcessor';
if (class_exists($classNameExpanded, true)) {
$className = $classNameExpanded;
}
}
if ($className !== false) {
$processor = $this->objectManager->get($className, $this->form, $processorArguments);
if ($processor instanceof PostProcessorInterface) {
$processor->setControllerContext($this->controllerContext);
$html .= $processor->process();
}
}
}
}
return $html;
}
作者:khanhdeu
项目:typo3tes
/**
* Generates a frameset based on input configuration in a TypoScript array.
*
* @param array $setup The TypoScript properties of the PAGE object property "frameSet.". See link.
* @return string A <frameset> tag.
* @see TSpagegen::renderContentWithHeader()
* @todo Define visibility
*/
public function make($setup)
{
$content = '';
if (is_array($setup)) {
$sKeyArray = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($setup);
foreach ($sKeyArray as $theKey) {
$theValue = $setup[$theKey];
if ((int) $theKey && ($conf = $setup[$theKey . '.'])) {
switch ($theValue) {
case 'FRAME':
$typeNum = (int) $GLOBALS['TSFE']->tmpl->setup[$conf['obj'] . '.']['typeNum'];
if (!$conf['src'] && !$typeNum) {
$typeNum = -1;
}
$content .= '<frame' . $this->frameParams($conf, $typeNum) . ' />' . LF;
break;
case 'FRAMESET':
$frameset = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\FramesetRenderer');
$content .= $frameset->make($conf) . LF;
break;
}
}
}
return '<frameset' . $this->framesetParams($setup) . '>' . LF . $content . '</frameset>';
}
}
作者:plan2ne
项目:TYPO3.CM
/**
* Set the various properties for the element
*
* For this element this is the prefix, suffix and middleName if they will
* be shown in the form
*
* @param array $parameters Configuration array
* @return void
*/
protected function setVarious(array $parameters)
{
if (is_array($parameters)) {
$keys = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($parameters);
foreach ($keys as $key) {
$class = $parameters[$key];
if ((int) $key && strpos($key, '.') === FALSE) {
if (isset($parameters[$key . '.'])) {
$childElementArguments = $parameters[$key . '.'];
if (in_array($childElementArguments['name'], array('prefix', 'suffix', 'middleName'))) {
$this->configuration['various'][$childElementArguments['name']] = TRUE;
}
}
}
}
}
}
作者:adroll
项目:TYPO3.CM
/**
* Rendering of a "numerical array" of Form objects from TypoScript
* Creates new object for each element found
*
* @param AbstractJsonElement $parentElement Parent model object
* @param array $typoscript Configuration array
* @return void
*/
protected function getChildElementsByIntegerKey(AbstractJsonElement $parentElement, array $typoscript)
{
if (is_array($typoscript)) {
$keys = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($typoscript);
foreach ($keys as $key) {
$class = $typoscript[$key];
if ((int) $key && strpos($key, '.') === FALSE) {
if (isset($typoscript[$key . '.'])) {
$elementArguments = $typoscript[$key . '.'];
} else {
$elementArguments = array();
}
$this->setElementType($parentElement, $class, $elementArguments);
}
}
}
}
作者:nicksergi
项目:TYPO3v4-Cor
/**
* Rendering of a "numerical array" of Form objects from TypoScript
* Creates new object for each element found
*
* @param \TYPO3\CMS\Form\Domain\Model\Json\AbstractJsonElement $parentElement Parent model object
* @param array $arguments Configuration array
* @return void
*/
protected function getChildElementsByIntegerKey(\TYPO3\CMS\Form\Domain\Model\Json\AbstractJsonElement $parentElement, array $typoscript)
{
if (is_array($typoscript)) {
$keys = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($typoscript);
foreach ($keys as $key) {
$class = $typoscript[$key];
if (intval($key) && !strstr($key, '.')) {
if (isset($typoscript[$key . '.'])) {
$elementArguments = $typoscript[$key . '.'];
} else {
$elementArguments = array();
}
$this->setElementType($parentElement, $class, $elementArguments);
}
}
}
}
作者:patrickbroen
项目:TYPO3.ContentRenderingCor
/**
* Check for the availability of processors, defined in TypoScript, and use them for data processing
*
* @param ContentObjectRenderer $cObject
* @param array $configuration Configuration array
* @param array $variables the variables to be processed
* @return array the processed data and variables as key/value store
* @throws \UnexpectedValueException If a processor class does not exist
*/
public function process(ContentObjectRenderer $cObject, array $configuration, array $variables)
{
if (!empty($configuration['dataProcessing.']) && is_array($configuration['dataProcessing.'])) {
$processors = $configuration['dataProcessing.'];
$processorKeys = TemplateService::sortedKeyList($processors);
foreach ($processorKeys as $key) {
$className = $processors[$key];
if (!class_exists($className)) {
throw new \UnexpectedValueException('Processor class name "' . $className . '" does not exist!', 1427455378);
}
if (!in_array(DataProcessorInterface::class, class_implements($className), true)) {
throw new \UnexpectedValueException('Processor with class name "' . $className . '" ' . 'must implement interface "' . DataProcessorInterface::class . '"', 1427455377);
}
$processorConfiguration = isset($processors[$key . '.']) ? $processors[$key . '.'] : array();
$variables = GeneralUtility::makeInstance($className)->process($cObject, $configuration, $processorConfiguration, $variables);
}
}
return $variables;
}
作者:nicksergi
项目:TYPO3v4-Cor
/**
* Set the options for this object
*
* @param array $parameters Configuration array
* @return void
*/
protected function setOptions(array $parameters)
{
if (is_array($parameters)) {
$keys = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($parameters);
foreach ($keys as $key) {
$class = $parameters[$key];
if (intval($key) && !strstr($key, '.')) {
if (isset($parameters[$key . '.']) && $class === 'OPTION') {
$childElementArguments = $parameters[$key . '.'];
if (isset($childElementArguments['selected'])) {
$childElementArguments['attributes']['selected'] = $childElementArguments['selected'];
unset($childElementArguments['selected']);
}
$this->configuration['options'][] = $childElementArguments;
}
}
}
}
}
作者:khanhdeu
项目:typo3tes
/**
* Set the options for this object
*
* @param array $parameters Configuration array
* @return void
*/
protected function setOptions(array $parameters)
{
if (is_array($parameters)) {
$keys = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($parameters);
foreach ($keys as $key) {
$class = $parameters[$key];
if ((int) $key && strpos($key, '.') === FALSE) {
if (isset($parameters[$key . '.']) && $class === 'RADIO') {
$childElementArguments = $parameters[$key . '.'];
if (isset($childElementArguments['checked'])) {
$childElementArguments['attributes']['selected'] = 'selected';
unset($childElementArguments['checked']);
}
if (isset($childElementArguments['label.'])) {
$childElementArguments['data'] = $childElementArguments['label.']['value'];
unset($childElementArguments['label.']);
}
$this->configuration['options'][] = $childElementArguments;
}
}
}
}
}
作者:rickymathe
项目:TYPO3.CM
/**
* Build validation rules from typoscript.
* The old breakOnError property are no longer supported
*
* @param array $rawArgument
* @return void
*/
public function buildRules(array $rawArgument = array())
{
$userConfiguredFormTyposcript = $this->configuration->getTypoScript();
$rulesTyposcript = isset($userConfiguredFormTyposcript['rules.']) ? $userConfiguredFormTyposcript['rules.'] : null;
$this->rules[$this->configuration->getPrefix()] = array();
if (is_array($rulesTyposcript)) {
$keys = TemplateService::sortedKeyList($rulesTyposcript);
foreach ($keys as $key) {
$ruleName = $rulesTyposcript[$key];
$validatorClassName = $this->typoScriptRepository->getRegisteredClassName($ruleName, 'registeredValidators');
if ($validatorClassName === null) {
throw new \RuntimeException('Class "' . $validatorClassName . '" not registered via typoscript.');
}
if ((int) $key && strpos($key, '.') === false) {
$ruleArguments = $rulesTyposcript[$key . '.'];
$fieldName = $this->formUtility->sanitizeNameAttribute($ruleArguments['element']);
// remove unsupported validator options
$validatorOptions = $ruleArguments;
$validatorOptions['errorMessage'] = array($ruleArguments['error.'], $ruleArguments['error']);
$keysToRemove = array_flip(array('breakOnError', 'message', 'message.', 'error', 'error.', 'showMessage'));
$validatorOptions = array_diff_key($validatorOptions, $keysToRemove);
// Instantiate the validator to check if all required options are assigned
// and to use the validator message rendering function to pre-render the mandatory message
/** @var AbstractValidator $validator */
$validator = $this->objectManager->get($validatorClassName, $validatorOptions);
if ($validator instanceof AbstractValidator) {
$validator->setRawArgument($rawArgument);
$validator->setFormUtility($this->formUtility);
if ((int) $ruleArguments['showMessage'] === 1) {
$mandatoryMessage = $validator->renderMessage($ruleArguments['message.'], $ruleArguments['message']);
} else {
$mandatoryMessage = NULL;
}
$this->rules[$this->configuration->getPrefix()][$fieldName][] = array('validator' => $validator, 'validatorName' => $validatorClassName, 'validatorOptions' => $validatorOptions, 'mandatoryMessage' => $mandatoryMessage);
} else {
throw new \RuntimeException('Class "' . $validatorClassName . '" could not be loaded.');
}
}
}
}
}
作者:vip3ou
项目:TYPO3.CM
/**
* orderedStdWrap
* Calls stdWrap for each entry in the provided array
*
* @param string $content Input value undergoing processing in this function.
* @param array $conf stdWrap properties for orderedStdWrap.
* @return string The processed input value
*/
public function stdWrap_orderedStdWrap($content = '', $conf = array())
{
$sortedKeysArray = TemplateService::sortedKeyList($conf['orderedStdWrap.'], true);
foreach ($sortedKeysArray as $key) {
$content = $this->stdWrap($content, $conf['orderedStdWrap.'][$key . '.']);
}
return $content;
}
作者:grauru
项目:testgit_t3
/**
* Handles the incoming form data
*
* @param Element $element
* @param array $userConfiguredElementTypoScript
* @return array
*/
protected function handleIncomingValues(Element $element, array $userConfiguredElementTypoScript)
{
if (!$this->getIncomingData()) {
return;
}
$elementName = $element->getName();
if ($element->getHtmlAttribute('value') !== null) {
$modelValue = $element->getHtmlAttribute('value');
} else {
$modelValue = $element->getAdditionalArgument('value');
}
if ($this->getIncomingData()->getIncomingField($elementName) !== null) {
/* filter values and set it back to incoming fields */
/* remove xss every time */
$userConfiguredElementTypoScript['filters.'][-1] = 'removexss';
$keys = TemplateService::sortedKeyList($userConfiguredElementTypoScript['filters.']);
foreach ($keys as $key) {
$class = $userConfiguredElementTypoScript['filters.'][$key];
if ((int) $key && strpos($key, '.') === false) {
$filterArguments = $userConfiguredElementTypoScript['filters.'][$key . '.'];
$filterClassName = $this->typoScriptRepository->getRegisteredClassName((string) $class, 'registeredFilters');
if ($filterClassName !== null) {
// toDo: handel array values
if (is_string($this->getIncomingData()->getIncomingField($elementName))) {
if (is_null($filterArguments)) {
$filter = $this->objectManager->get($filterClassName);
} else {
$filter = $this->objectManager->get($filterClassName, $filterArguments);
}
if ($filter) {
$value = $filter->filter($this->getIncomingData()->getIncomingField($elementName));
$this->getIncomingData()->setIncomingField($elementName, $value);
} else {
throw new \RuntimeException('Class "' . $filterClassName . '" could not be loaded.');
}
}
} else {
throw new \RuntimeException('Class "' . $filterClassName . '" not registered via TypoScript.');
}
}
}
if ($element->getHtmlAttribute('value') !== null) {
$element->setHtmlAttribute('value', $this->getIncomingData()->getIncomingField($elementName));
} else {
$element->setAdditionalArgument('value', $this->getIncomingData()->getIncomingField($elementName));
}
}
$this->signalSlotDispatcher->dispatch(__CLASS__, 'txFormHandleIncomingValues', array($element, $this->getIncomingData(), $modelValue, $this));
}
作者:khanhdeu
项目:typo3tes
/**
* Wrapper method for \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList
* (makes unit testing possible)
*
* @return array
* @deprecated in TYPO3 CMS 7, does not trigger deprecation log in 6.2
*/
public function sortTypoScriptKeyList()
{
return \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($this->typoScript);
}
作者:rickymathe
项目:TYPO3.CM
/**
* The actual rendering of the image file.
* Basically sets the dimensions, the background color, the traverses the array of GIFBUILDER objects and finally setting the transparent color if defined.
* Creates a GDlib resource in $this->im and works on that
* Called by gifBuild()
*
* @return void
* @access private
* @see gifBuild()
*/
public function make()
{
// Get trivial data
$XY = $this->XY;
// Reset internal properties
$this->saveAlphaLayer = false;
// Gif-start
$this->im = imagecreatetruecolor($XY[0], $XY[1]);
$this->w = $XY[0];
$this->h = $XY[1];
// Transparent layer as background if set and requirements are met
if (!empty($this->setup['backColor']) && $this->setup['backColor'] === 'transparent' && $this->png_truecolor && !$this->setup['reduceColors'] && (empty($this->setup['format']) || $this->setup['format'] === 'png')) {
// Set transparency properties
imagesavealpha($this->im, true);
// Fill with a transparent background
$transparentColor = imagecolorallocatealpha($this->im, 0, 0, 0, 127);
imagefill($this->im, 0, 0, $transparentColor);
// Set internal properties to keep the transparency over the rendering process
$this->saveAlphaLayer = true;
// Force PNG in case no format is set
$this->setup['format'] = 'png';
$BGcols = array();
} else {
// Fill the background with the given color
$BGcols = $this->convertColor($this->setup['backColor']);
$Bcolor = ImageColorAllocate($this->im, $BGcols[0], $BGcols[1], $BGcols[2]);
ImageFilledRectangle($this->im, 0, 0, $XY[0], $XY[1], $Bcolor);
}
// Traverse the GIFBUILDER objects an render each one:
if (is_array($this->setup)) {
$sKeyArray = TemplateService::sortedKeyList($this->setup);
foreach ($sKeyArray as $theKey) {
$theValue = $this->setup[$theKey];
if ((int) $theKey && ($conf = $this->setup[$theKey . '.'])) {
// apply stdWrap to all properties, except for TEXT objects
// all properties of the TEXT sub-object have already been stdWrap-ped
// before in ->checkTextObj()
if ($theValue !== 'TEXT') {
$isStdWrapped = array();
foreach ($conf as $key => $value) {
$parameter = rtrim($key, '.');
if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
$conf[$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
$isStdWrapped[$parameter] = 1;
}
}
}
switch ($theValue) {
case 'IMAGE':
if ($conf['mask']) {
$this->maskImageOntoImage($this->im, $conf, $this->workArea);
} else {
$this->copyImageOntoImage($this->im, $conf, $this->workArea);
}
break;
case 'TEXT':
if (!$conf['hide']) {
if (is_array($conf['shadow.'])) {
$isStdWrapped = array();
foreach ($conf['shadow.'] as $key => $value) {
$parameter = rtrim($key, '.');
if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
$conf['shadow.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
$isStdWrapped[$parameter] = 1;
}
}
$this->makeShadow($this->im, $conf['shadow.'], $this->workArea, $conf);
}
if (is_array($conf['emboss.'])) {
$isStdWrapped = array();
foreach ($conf['emboss.'] as $key => $value) {
$parameter = rtrim($key, '.');
if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
$conf['emboss.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
$isStdWrapped[$parameter] = 1;
}
}
$this->makeEmboss($this->im, $conf['emboss.'], $this->workArea, $conf);
}
if (is_array($conf['outline.'])) {
$isStdWrapped = array();
foreach ($conf['outline.'] as $key => $value) {
$parameter = rtrim($key, '.');
if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
$conf['outline.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
$isStdWrapped[$parameter] = 1;
}
}
$this->makeOutline($this->im, $conf['outline.'], $this->workArea, $conf);
}
//.........这里部分代码省略.........
作者:noxlud
项目:TYPO3v4-Cor
/**
* Set the validation rules
*
* Makes the validation object and adds rules to it
*
* @param array $typoscript TypoScript
* @return \TYPO3\CMS\Form\Utility\ValidatorUtility The validation object
*/
public function setRules(array $typoscript)
{
$rulesTyposcript = isset($typoscript['rules.']) ? $typoscript['rules.'] : NULL;
/** @var $rulesClass \TYPO3\CMS\Form\Utility\ValidatorUtility */
$rulesClass = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Utility\\ValidatorUtility', $rulesTyposcript);
// singleton
if (is_array($rulesTyposcript)) {
$keys = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($rulesTyposcript);
foreach ($keys as $key) {
$class = $rulesTyposcript[$key];
if (intval($key) && !strstr($key, '.')) {
$elementArguments = $rulesTyposcript[$key . '.'];
$rule = $rulesClass->createRule($class, $elementArguments);
$rule->setFieldName($elementArguments['element']);
$breakOnError = isset($elementArguments['breakOnError']) ? $elementArguments['breakOnError'] : FALSE;
$rulesClass->addRule($rule, $elementArguments['element'], $breakOnError);
}
}
}
return $rulesClass;
}
作者:samuweis
项目:TYPO3-Sit
/**
* Will traverse input array with configuration per-item and create corresponding GIF files for the menu.
* The data of the files are stored in $this->result
*
* @param array $conf Array with configuration for each item.
* @return void
* @access private
* @see generate()
* @todo Define visibility
*/
public function makeImageMap($conf)
{
if (!is_array($conf)) {
$conf = array();
}
if (is_array($this->mconf['main.'])) {
$gifCreator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Imaging\\GifBuilder');
$gifCreator->init();
$itemsConf = $conf;
$conf = $this->mconf['main.'];
if (is_array($conf)) {
$gifObjCount = 0;
$sKeyArray = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($conf);
$gifObjCount = (int) end($sKeyArray);
$lastOriginal = $gifObjCount;
// Now we add graphical objects to the gifbuilder-setup
$waArr = array();
foreach ($itemsConf as $key => $val) {
if (is_array($val)) {
$gifObjCount++;
$waArr[$key]['free'] = $gifObjCount;
$sKeyArray = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($val);
foreach ($sKeyArray as $theKey) {
$theValue = $val[$theKey];
if ((int) $theKey && ($theValArr = $val[$theKey . '.'])) {
$cObjData = $this->menuArr[$key] ?: array();
$gifObjCount++;
if ($theValue == 'TEXT') {
$waArr[$key]['textNum'] = $gifObjCount;
$gifCreator->data = $cObjData;
$theValArr = $gifCreator->checkTextObj($theValArr);
// if this is not done it seems that imageMaps will be rendered wrong!!
unset($theValArr['text.']);
// check links
$LD = $this->menuTypoLink($this->menuArr[$key], $this->mconf['target'], '', '', array(), '', $this->mconf['forceTypeValue']);
// If access restricted pages should be shown in menus, change the link of such pages to link to a redirection page:
$this->changeLinksForAccessRestrictedPages($LD, $this->menuArr[$key], $this->mconf['target'], $this->mconf['forceTypeValue']);
// Overriding URL / Target if set to do so:
if ($this->menuArr[$key]['_OVERRIDE_HREF']) {
$LD['totalURL'] = $this->menuArr[$key]['_OVERRIDE_HREF'];
if ($this->menuArr[$key]['_OVERRIDE_TARGET']) {
$LD['target'] = $this->menuArr[$key]['_OVERRIDE_TARGET'];
}
}
// Setting target/url for Image Map:
if ($theValArr['imgMap.']['url'] == '') {
$theValArr['imgMap.']['url'] = $LD['totalURL'];
}
if ($theValArr['imgMap.']['target'] == '') {
$theValArr['imgMap.']['target'] = $LD['target'];
}
if (is_array($theValArr['imgMap.']['altText.'])) {
$cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$cObj->start($cObjData, 'pages');
if (isset($theValArr['imgMap.']['altText.'])) {
$theValArr['imgMap.']['altText'] = $cObj->stdWrap($theValArr['imgMap.']['altText'], $theValArr['imgMap.']['altText.']);
}
unset($theValArr['imgMap.']['altText.']);
}
if (is_array($theValArr['imgMap.']['titleText.'])) {
$cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$cObj->start($cObjData, 'pages');
if (isset($theValArr['imgMap.']['titleText.'])) {
$theValArr['imgMap.']['titleText'] = $cObj->stdWrap($theValArr['imgMap.']['titleText'], $theValArr['imgMap.']['titleText.']);
}
unset($theValArr['imgMap.']['titleText.']);
}
}
// This code goes one level in if the object is an image. If 'file' and/or 'mask' appears to be GIFBUILDER-objects, they are both searched for TEXT objects, and if a textobj is found, it's checked with the currently loaded record!!
if ($theValue == 'IMAGE') {
if ($theValArr['file'] == 'GIFBUILDER') {
$temp_sKeyArray = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($theValArr['file.']);
foreach ($temp_sKeyArray as $temp_theKey) {
if ($theValArr['mask.'][$temp_theKey] == 'TEXT') {
$gifCreator->data = $this->menuArr[$key] ?: array();
$theValArr['mask.'][$temp_theKey . '.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey . '.']);
// If this is not done it seems that imageMaps will be rendered wrong!!
unset($theValArr['mask.'][$temp_theKey . '.']['text.']);
}
}
}
if ($theValArr['mask'] == 'GIFBUILDER') {
$temp_sKeyArray = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($theValArr['mask.']);
foreach ($temp_sKeyArray as $temp_theKey) {
if ($theValArr['mask.'][$temp_theKey] == 'TEXT') {
$gifCreator->data = $this->menuArr[$key] ?: array();
$theValArr['mask.'][$temp_theKey . '.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey . '.']);
// if this is not done it seems that imageMaps will be rendered wrong!!
unset($theValArr['mask.'][$temp_theKey . '.']['text.']);
}
//.........这里部分代码省略.........
作者:TYPO3Incubato
项目:TYPO3.CM
/**
* Splitting a string for ImageTTFBBox up into an array where each part has its own configuration options.
*
* @param string $string UTF-8 string
* @param array $splitRendering Split-rendering configuration from GIFBUILDER TEXT object.
* @param int $fontSize Current fontsize
* @param string $fontFile Current font file
* @return array Array with input string splitted according to configuration
*/
public function splitString($string, $splitRendering, $fontSize, $fontFile)
{
// Initialize by setting the whole string and default configuration as the first entry.
$result = array();
$result[] = array('str' => $string, 'fontSize' => $fontSize, 'fontFile' => $fontFile);
// Traverse the split-rendering configuration:
// Splitting will create more entries in $result with individual configurations.
if (is_array($splitRendering)) {
$sKeyArray = TemplateService::sortedKeyList($splitRendering);
// Traverse configured options:
foreach ($sKeyArray as $key) {
$cfg = $splitRendering[$key . '.'];
// Process each type of split rendering keyword:
switch ((string) $splitRendering[$key]) {
case 'highlightWord':
if ((string) $cfg['value'] !== '') {
$newResult = array();
// Traverse the current parts of the result array:
foreach ($result as $part) {
// Explode the string value by the word value to highlight:
$explodedParts = explode($cfg['value'], $part['str']);
foreach ($explodedParts as $c => $expValue) {
if ((string) $expValue !== '') {
$newResult[] = array_merge($part, array('str' => $expValue));
}
if ($c + 1 < count($explodedParts)) {
$newResult[] = array('str' => $cfg['value'], 'fontSize' => $cfg['fontSize'] ? $cfg['fontSize'] : $part['fontSize'], 'fontFile' => $cfg['fontFile'] ? $cfg['fontFile'] : $part['fontFile'], 'color' => $cfg['color'], 'xSpaceBefore' => $cfg['xSpaceBefore'], 'xSpaceAfter' => $cfg['xSpaceAfter'], 'ySpaceBefore' => $cfg['ySpaceBefore'], 'ySpaceAfter' => $cfg['ySpaceAfter']);
}
}
}
// Set the new result as result array:
if (!empty($newResult)) {
$result = $newResult;
}
}
break;
case 'charRange':
if ((string) $cfg['value'] !== '') {
// Initialize range:
$ranges = GeneralUtility::trimExplode(',', $cfg['value'], true);
foreach ($ranges as $i => $rangeDef) {
$ranges[$i] = GeneralUtility::intExplode('-', $ranges[$i]);
if (!isset($ranges[$i][1])) {
$ranges[$i][1] = $ranges[$i][0];
}
}
$newResult = array();
// Traverse the current parts of the result array:
foreach ($result as $part) {
// Initialize:
$currentState = -1;
$bankAccum = '';
// Explode the string value by the word value to highlight:
$utf8Chars = $this->csConvObj->utf8_to_numberarray($part['str'], true, true);
foreach ($utf8Chars as $utfChar) {
// Find number and evaluate position:
$uNumber = (int) $this->csConvObj->utf8CharToUnumber($utfChar);
$inRange = 0;
foreach ($ranges as $rangeDef) {
if ($uNumber >= $rangeDef[0] && (!$rangeDef[1] || $uNumber <= $rangeDef[1])) {
$inRange = 1;
break;
}
}
if ($currentState == -1) {
$currentState = $inRange;
}
// Initialize first char
// Switch bank:
if ($inRange != $currentState && $uNumber !== 9 && $uNumber !== 10 && $uNumber !== 13 && $uNumber !== 32) {
// Set result:
if ($bankAccum !== '') {
$newResult[] = array('str' => $bankAccum, 'fontSize' => $currentState && $cfg['fontSize'] ? $cfg['fontSize'] : $part['fontSize'], 'fontFile' => $currentState && $cfg['fontFile'] ? $cfg['fontFile'] : $part['fontFile'], 'color' => $currentState ? $cfg['color'] : '', 'xSpaceBefore' => $currentState ? $cfg['xSpaceBefore'] : '', 'xSpaceAfter' => $currentState ? $cfg['xSpaceAfter'] : '', 'ySpaceBefore' => $currentState ? $cfg['ySpaceBefore'] : '', 'ySpaceAfter' => $currentState ? $cfg['ySpaceAfter'] : '');
}
// Initialize new settings:
$currentState = $inRange;
$bankAccum = '';
}
// Add char to bank:
$bankAccum .= $utfChar;
}
// Set result for FINAL part:
if ($bankAccum !== '') {
$newResult[] = array('str' => $bankAccum, 'fontSize' => $currentState && $cfg['fontSize'] ? $cfg['fontSize'] : $part['fontSize'], 'fontFile' => $currentState && $cfg['fontFile'] ? $cfg['fontFile'] : $part['fontFile'], 'color' => $currentState ? $cfg['color'] : '', 'xSpaceBefore' => $currentState ? $cfg['xSpaceBefore'] : '', 'xSpaceAfter' => $currentState ? $cfg['xSpaceAfter'] : '', 'ySpaceBefore' => $currentState ? $cfg['ySpaceBefore'] : '', 'ySpaceAfter' => $currentState ? $cfg['ySpaceAfter'] : '');
}
}
// Set the new result as result array:
if (!empty($newResult)) {
$result = $newResult;
}
}
//.........这里部分代码省略.........
作者:cabservicesa
项目:compatibility
/**
* Rendering the cObject, FORM
*
* Note on $formData:
* In the optional $formData array each entry represents a line in the ordinary setup.
* In those entries each entry (0,1,2...) represents a space normally divided by the '|' line.
*
* $formData [] = array('Name:', 'name=input, 25 ', 'Default value....');
* $formData [] = array('Email:', 'email=input, 25 ', 'Default value for email....');
*
* - corresponds to the $conf['data'] value being :
* Name:|name=input, 25 |Default value....||Email:|email=input, 25 |Default value for email....
*
* If $formData is an array the value of $conf['data'] is ignored.
*
* @param array $conf Array of TypoScript properties
* @param array $formData Alternative formdata overriding whatever comes from TypoScript
* @return string Output
*/
public function render($conf = array(), $formData = '')
{
$content = '';
if (is_array($formData)) {
$dataArray = $formData;
} else {
$data = isset($conf['data.']) ? $this->cObj->stdWrap($conf['data'], $conf['data.']) : $conf['data'];
// Clearing dataArr
$dataArray = array();
// Getting the original config
if (trim($data)) {
$data = str_replace(LF, '||', $data);
$dataArray = explode('||', $data);
}
// Adding the new dataArray config form:
if (is_array($conf['dataArray.'])) {
// dataArray is supplied
$sortedKeyArray = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($conf['dataArray.'], true);
foreach ($sortedKeyArray as $theKey) {
$singleKeyArray = $conf['dataArray.'][$theKey . '.'];
if (is_array($singleKeyArray)) {
$temp = array();
$label = isset($singleKeyArray['label.']) ? $this->cObj->stdWrap($singleKeyArray['label'], $singleKeyArray['label.']) : $singleKeyArray['label'];
list($temp[0]) = explode('|', $label);
$type = isset($singleKeyArray['type.']) ? $this->cObj->stdWrap($singleKeyArray['type'], $singleKeyArray['type.']) : $singleKeyArray['type'];
list($temp[1]) = explode('|', $type);
$required = isset($singleKeyArray['required.']) ? $this->cObj->stdWrap($singleKeyArray['required'], $singleKeyArray['required.']) : $singleKeyArray['required'];
if ($required) {
$temp[1] = '*' . $temp[1];
}
$singleValue = isset($singleKeyArray['value.']) ? $this->cObj->stdWrap($singleKeyArray['value'], $singleKeyArray['value.']) : $singleKeyArray['value'];
list($temp[2]) = explode('|', $singleValue);
// If value array is set, then implode those values.
if (is_array($singleKeyArray['valueArray.'])) {
$temp_accumulated = array();
foreach ($singleKeyArray['valueArray.'] as $singleKey => $singleKey_valueArray) {
if (is_array($singleKey_valueArray) && (int) $singleKey . '.' === (string) $singleKey) {
$temp_valueArray = array();
$valueArrayLabel = isset($singleKey_valueArray['label.']) ? $this->cObj->stdWrap($singleKey_valueArray['label'], $singleKey_valueArray['label.']) : $singleKey_valueArray['label'];
list($temp_valueArray[0]) = explode('=', $valueArrayLabel);
$selected = isset($singleKey_valueArray['selected.']) ? $this->cObj->stdWrap($singleKey_valueArray['selected'], $singleKey_valueArray['selected.']) : $singleKey_valueArray['selected'];
if ($selected) {
$temp_valueArray[0] = '*' . $temp_valueArray[0];
}
$singleKeyValue = isset($singleKey_valueArray['value.']) ? $this->cObj->stdWrap($singleKey_valueArray['value'], $singleKey_valueArray['value.']) : $singleKey_valueArray['value'];
list($temp_valueArray[1]) = explode(',', $singleKeyValue);
}
$temp_accumulated[] = implode('=', $temp_valueArray);
}
$temp[2] = implode(',', $temp_accumulated);
}
$specialEval = isset($singleKeyArray['specialEval.']) ? $this->cObj->stdWrap($singleKeyArray['specialEval'], $singleKeyArray['specialEval.']) : $singleKeyArray['specialEval'];
list($temp[3]) = explode('|', $specialEval);
// Adding the form entry to the dataArray
$dataArray[] = implode('|', $temp);
}
}
}
}
$attachmentCounter = '';
$hiddenfields = '';
$fieldlist = array();
$propertyOverride = array();
$fieldname_hashArray = array();
$counter = 0;
$xhtmlStrict = GeneralUtility::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype);
// Formname
$formName = isset($conf['formName.']) ? $this->cObj->stdWrap($conf['formName'], $conf['formName.']) : $conf['formName'];
$formName = $this->cleanFormName($formName);
$formName = $GLOBALS['TSFE']->getUniqueId($formName);
$fieldPrefix = isset($conf['fieldPrefix.']) ? $this->cObj->stdWrap($conf['fieldPrefix'], $conf['fieldPrefix.']) : $conf['fieldPrefix'];
if (isset($conf['fieldPrefix']) || isset($conf['fieldPrefix.'])) {
if ($fieldPrefix) {
$prefix = $this->cleanFormName($fieldPrefix);
} else {
$prefix = '';
}
} else {
$prefix = $formName;
}
foreach ($dataArray as $dataValue) {
//.........这里部分代码省略.........
作者:khanhdeu
项目:typo3tes
/**
* orderedStdWrap
* Calls stdWrap for each entry in the provided array
*
* @param string $content Input value undergoing processing in this function.
* @param array $conf stdWrap properties for orderedStdWrap.
* @return string The processed input value
*/
public function stdWrap_orderedStdWrap($content = '', $conf = array())
{
$sortedKeysArray = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($conf['orderedStdWrap.'], TRUE);
foreach ($sortedKeysArray as $key) {
$content = $this->stdWrap($content, $conf['orderedStdWrap.'][$key . '.']);
}
return $content;
}
作者:plan2ne
项目:TYPO3.CM
/**
* Check for the availability of processors, defined in TypoScript, and use them for data processing
*
* @param array $configuration Configuration array
* @param array $variables the variables to be processed
* @return array the processed data and variables as key/value store
* @throws \UnexpectedValueException
*/
protected function processData(array $configuration, array $variables)
{
if (!empty($configuration['dataProcessing.']) && is_array($configuration['dataProcessing.'])) {
$processors = $configuration['dataProcessing.'];
$processorKeys = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($processors);
foreach ($processorKeys as $key) {
$className = $processors[$key];
$processor = GeneralUtility::makeInstance($className);
if (!$processor instanceof DataProcessorInterface) {
throw new \UnexpectedValueException('$processor with class name "' . $className . '" ' . 'must implement interface "' . DataProcessorInterface::class . '"', 1427455377);
}
$processorConfiguration = isset($processors[$key . '.']) ? $processors[$key . '.'] : array();
$variables = $processor->process($this->cObj, $configuration, $processorConfiguration, $variables);
}
}
return $variables;
}