TYPO3 CMS  TYPO3_6-2
ConfigurationForm.php
Go to the documentation of this file.
1 <?php
3 
22 
23  // Internal
27  public $categories = array();
28 
33 
37  public $ext_CEformName = 'tsStyleConfigForm';
38 
42  public $ext_printAll = 1;
43 
47  public $ext_incomingValues = array();
48 
57  public function ext_initTSstyleConfig($configTemplate, $pathRel, $pathAbs, $backPath) {
58  // Do not log time-performance information
59  $this->tt_track = 0;
60  $this->constants = array($configTemplate, '');
61  // The editable constants are returned in an array.
62  $theConstants = $this->generateConfig_constants();
63  $this->ext_localGfxPrefix = $pathAbs;
64  $this->ext_localWebGfxPrefix = $backPath . $pathRel;
65  $this->ext_backPath = $backPath;
66  return $theConstants;
67  }
68 
77  public function ext_setValueArray($theConstants, $valueArray) {
78  $temp = $this->flatSetup;
79  $this->flatSetup = array();
80  $this->flattenSetup($valueArray, '', '');
81  $this->objReg = ($this->ext_realValues = $this->flatSetup);
82  $this->flatSetup = $temp;
83  foreach ($theConstants as $k => $p) {
84  if (isset($this->objReg[$k])) {
85  $theConstants[$k]['value'] = $this->ext_realValues[$k];
86  }
87  }
88  // Reset the default pool of categories.
89  $this->categories = array();
90  // The returned constants are sorted in categories, that goes into the $this->categories array
91  $this->ext_categorizeEditableConstants($theConstants);
92  return $theConstants;
93  }
94 
101  public function ext_getCategoriesForModMenu() {
102  return $this->ext_getCategoryLabelArray();
103  }
104 
112  public function ext_makeHelpInformationForCategory($cat) {
113  return $this->ext_getTSCE_config($cat);
114  }
115 
128  public function ext_getForm($cat, $theConstants, $script = '', $addFields = '', $extKey = '', $addFormTag = TRUE) {
130  $printFields = trim($this->ext_printFields($theConstants, $cat));
131  $content = '';
133  function uFormUrl(aname) {
134  document.' . $this->ext_CEformName . '.action = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript() . '#') . '+aname;
135  }
136  ');
137  if ($addFormTag) {
138  $content .= '<form action="' . htmlspecialchars(($script ?: \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript())) . '" name="' . $this->ext_CEformName . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
139  }
140  $content .= $addFields;
141  $content .= $printFields;
142  $content .= '<input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tsfe.xlf:update', TRUE) . '" id="configuration-submit-' . htmlspecialchars($extKey) . '" />';
143  $example = $this->ext_displayExample();
144  $content .= $example ? '<hr/>' . $example : '';
145  return $content;
146  }
147 
154  public function ext_displayExample() {
155  if ($this->helpConfig['imagetag'] || $this->helpConfig['description'] || $this->helpConfig['header']) {
156  $out = '<div align="center">' . $this->helpConfig['imagetag'] . '</div><BR>' . ($this->helpConfig['description'] ? implode(explode('//', $this->helpConfig['description']), '<BR>') . '<BR>' : '') . ($this->helpConfig['bulletlist'] ? '<ul><li>' . implode(explode('//', $this->helpConfig['bulletlist']), '<li>') . '</ul>' : '<BR>');
157  }
158  return $out;
159  }
160 
168  public function ext_mergeIncomingWithExisting($arr) {
169  $parseObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
170  $parseObj->parse(implode(LF, $this->ext_incomingValues));
171  $arr2 = $parseObj->setup;
173  return $arr;
174  }
175 
176  // Extends:
180  public function ext_getKeyImage($key) {
181  return '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->ext_backPath, ('gfx/rednumbers/' . $key . '.gif'), '') . ' hspace="2" align="top" alt="" />';
182  }
183 
191  public function ext_getTSCE_config_image($imgConf) {
192  $iFile = $this->ext_localGfxPrefix . $imgConf;
193  $tFile = $this->ext_localWebGfxPrefix . $imgConf;
194  $imageInfo = @getImagesize($iFile);
195  return '<img src="' . $tFile . '" ' . $imageInfo[3] . '>';
196  }
197 
205  public function ext_fNandV($params) {
206  $fN = 'data[' . $params['name'] . ']';
207  $fV = ($params['value'] = isset($this->ext_realValues[$params['name']]) ? $this->ext_realValues[$params['name']] : $params['default_value']);
208  $reg = array();
209  // Values entered from the constantsedit cannot be constants!
210  if (preg_match('/^\\{[\\$][a-zA-Z0-9\\.]*\\}$/', trim($fV), $reg)) {
211  $fV = '';
212  }
213  $fV = htmlspecialchars($fV);
214  return array($fN, $fV, $params);
215  }
216 
225  public function ext_putValueInConf($key, $var) {
226  $this->ext_incomingValues[$key] = $key . '=' . $var;
227  }
228 
236  public function ext_removeValueInConf($key) {
237 
238  }
239 
240 }
static mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys=TRUE, $includeEmptyValues=TRUE, $enableUnsetFeature=TRUE)
static skinImg($backPath, $src, $wHattribs='', $outputMode=0)
ext_initTSstyleConfig($configTemplate, $pathRel, $pathAbs, $backPath)
ext_getForm($cat, $theConstants, $script='', $addFields='', $extKey='', $addFormTag=TRUE)
ext_setValueArray($theConstants, $valueArray)
static linkThisScript(array $getParams=array())
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static wrapJS($string, $linebreak=TRUE)