本文整理匯總了PHP中t3lib_BEfunc::getSpecConfParametersFromArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP t3lib_BEfunc::getSpecConfParametersFromArray方法的具體用法?PHP t3lib_BEfunc::getSpecConfParametersFromArray怎麽用?PHP t3lib_BEfunc::getSpecConfParametersFromArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類t3lib_BEfunc
的用法示例。
在下文中一共展示了t3lib_BEfunc::getSpecConfParametersFromArray方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isRTEforField
/**
* Checking if the RTE is available/enabled for a certain table/field and if so, it returns true.
* Used to determine if the RTE button should be displayed.
*
* @param string Table name
* @param array Record row (needed, if there are RTE dependencies based on other fields in the record)
* @param string Field name
* @return boolean Returns true if the rich text editor would be enabled/available for the field name specified.
*/
function isRTEforField($table, $row, $field)
{
$specConf = $this->getSpecConfForField($table, $row, $field);
$p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) {
t3lib_BEfunc::fixVersioningPid($table, $row);
list($tscPID, $thePidValue) = t3lib_BEfunc::getTSCpid($table, $row['uid'], $row['pid']);
if ($thePidValue >= 0) {
// If the pid-value is not negative (that is, a pid could NOT be fetched)
$RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($tscPID));
$RTEtypeVal = t3lib_BEfunc::getTCAtypeValue($table, $row);
$thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'], $table, $field, $RTEtypeVal);
if (!$thisConfig['disabled']) {
return TRUE;
}
}
}
return FALSE;
}
示例2: transformContent
/**
* Performs transformation of content to/from RTE. The keyword $dirRTE determines the direction.
* This function is called in two situations:
* a) Right before content from database is sent to the RTE (see ->drawRTE()) it might need transformation
* b) When content is sent from the RTE and into the database it might need transformation back again (going on in TCEmain class; You can't affect that.)
*
* @param string Keyword: "rte" means direction from db to rte, "db" means direction from Rte to DB
* @param string Value to transform.
* @param string The table name
* @param string The field name
* @param array The current row from which field is being rendered
* @param array "special" configuration - what is found at position 4 in the types configuration of a field from record, parsed into an array.
* @param array Configuration for RTEs; A mix between TSconfig and otherwise. Contains configuration for display, which buttons are enabled, additional transformation information etc.
* @param string Relative path for images/links in RTE; this is used when the RTE edits content from static files where the path of such media has to be transformed forth and back!
* @param integer PID value of record (true parent page id)
* @return string Transformed content
*/
function transformContent($dirRTE, $value, $table, $field, $row, $specConf, $thisConfig, $RTErelPath, $pid)
{
#debug(array($dirRTE,$value,$table,$field,array(),$specConf,$thisConfig,$RTErelPath,$pid));
if ($specConf['rte_transform']) {
$p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
if ($p['mode']) {
// There must be a mode set for transformation
#debug($p['mode'],'MODE');
// Initialize transformation:
$parseHTML = t3lib_div::makeInstance('t3lib_parsehtml_proc');
$parseHTML->init($table . ':' . $field, $pid);
$parseHTML->setRelPath($RTErelPath);
// Perform transformation:
$value = $parseHTML->RTE_transform($value, $specConf, $dirRTE, $thisConfig);
}
}
#debug(array($dirRTE,$value),'OUT: '.$dirRTE);
return $value;
}
示例3: getSingleField_typeText
/**
* Generation of TCEform elements of the type "text"
* This will render a <textarea> OR RTE area form field, possibly with various control/validation features
*
* @param string The table name of the record
* @param string The field name which this element is supposed to edit
* @param array The record data array where the value(s) for the field can be found
* @param array An array with additional configuration options.
* @return string The HTML code for the TCEform field
*/
function getSingleField_typeText($table, $field, $row, &$PA)
{
// Init config:
$config = $PA['fieldConf']['config'];
$evalList = t3lib_div::trimExplode(',', $config['eval'], 1);
if ($this->renderReadonly || $config['readOnly']) {
return $this->getSingleField_typeNone_render($config, $PA['itemFormElValue']);
}
// Setting columns number:
$cols = t3lib_div::intInRange($config['cols'] ? $config['cols'] : 30, 5, $this->maxTextareaWidth);
// Setting number of rows:
$origRows = $rows = t3lib_div::intInRange($config['rows'] ? $config['rows'] : 5, 1, 20);
if (strlen($PA['itemFormElValue']) > $this->charsPerRow * 2) {
$cols = $this->maxTextareaWidth;
$rows = t3lib_div::intInRange(round(strlen($PA['itemFormElValue']) / $this->charsPerRow), count(explode(LF, $PA['itemFormElValue'])), 20);
if ($rows < $origRows) {
$rows = $origRows;
}
}
if (in_array('required', $evalList)) {
$this->requiredFields[$table . '_' . $row['uid'] . '_' . $field] = $PA['itemFormElName'];
}
// Init RTE vars:
$RTEwasLoaded = 0;
// Set true, if the RTE is loaded; If not a normal textarea is shown.
$RTEwouldHaveBeenLoaded = 0;
// Set true, if the RTE would have been loaded if it wasn't for the disable-RTE flag in the bottom of the page...
// "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. Traditionally, this is where RTE configuration has been found.
$specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']);
// Setting up the altItem form field, which is a hidden field containing the value
$altItem = '<input type="hidden" name="' . htmlspecialchars($PA['itemFormElName']) . '" value="' . htmlspecialchars($PA['itemFormElValue']) . '" />';
// If RTE is generally enabled (TYPO3_CONF_VARS and user settings)
if ($this->RTEenabled) {
$p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) {
// If the field is configured for RTE and if any flag-field is not set to disable it.
t3lib_BEfunc::fixVersioningPid($table, $row);
list($tscPID, $thePidValue) = $this->getTSCpid($table, $row['uid'], $row['pid']);
// If the pid-value is not negative (that is, a pid could NOT be fetched)
if ($thePidValue >= 0) {
$RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($tscPID));
$RTEtypeVal = t3lib_BEfunc::getTCAtypeValue($table, $row);
$thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'], $table, $field, $RTEtypeVal);
if (!$thisConfig['disabled']) {
if (!$this->disableRTE) {
$this->RTEcounter++;
// Find alternative relative path for RTE images/links:
$eFile = t3lib_parsehtml_proc::evalWriteFile($specConf['static_write'], $row);
$RTErelPath = is_array($eFile) ? dirname($eFile['relEditFile']) : '';
// Get RTE object, draw form and set flag:
$RTEobj = t3lib_BEfunc::RTEgetObj();
$item = $RTEobj->drawRTE($this, $table, $field, $row, $PA, $specConf, $thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue);
// Wizard:
$item = $this->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $PA, $PA['itemFormElName'], $specConf, 1);
$RTEwasLoaded = 1;
} else {
$RTEwouldHaveBeenLoaded = 1;
$this->commentMessages[] = $PA['itemFormElName'] . ': RTE is disabled by the on-page RTE-flag (probably you can enable it by the check-box in the bottom of this page!)';
}
} else {
$this->commentMessages[] = $PA['itemFormElName'] . ': RTE is disabled by the Page TSconfig, "RTE"-key (eg. by RTE.default.disabled=0 or such)';
}
} else {
$this->commentMessages[] = $PA['itemFormElName'] . ': PID value could NOT be fetched. Rare error, normally with new records.';
}
} else {
if (!isset($specConf['richtext'])) {
$this->commentMessages[] = $PA['itemFormElName'] . ': RTE was not configured for this field in TCA-types';
}
if (!(!$p['flag'] || !$row[$p['flag']])) {
$this->commentMessages[] = $PA['itemFormElName'] . ': Field-flag (' . $PA['flag'] . ') has been set to disable RTE!';
}
}
}
// Display ordinary field if RTE was not loaded.
if (!$RTEwasLoaded) {
if ($specConf['rte_only']) {
// Show message, if no RTE (field can only be edited with RTE!)
$item = '<p><em>' . htmlspecialchars($this->getLL('l_noRTEfound')) . '</em></p>';
} else {
if ($specConf['nowrap']) {
$wrap = 'off';
} else {
$wrap = $config['wrap'] ? $config['wrap'] : 'virtual';
}
$classes = array();
if ($specConf['fixed-font']) {
$classes[] = 'fixed-font';
}
if ($specConf['enable-tab']) {
//.........這裏部分代碼省略.........
示例4: RTE_transform
/**
* Transform value for RTE based on specConf in the direction specified by $direction (rte/db)
* This is the main function called from tcemain and transfer data classes
*
* @param string Input value
* @param array Special configuration for a field; This is coming from the types-configuration of the field in the TCA. In the types-configuration you can setup features for the field rendering and in particular the RTE takes al its major configuration options from there!
* @param string Direction of the transformation. Two keywords are allowed; "db" or "rte". If "db" it means the transformation will clean up content coming from the Rich Text Editor and goes into the database. The other direction, "rte", is of course when content is coming from database and must be transformed to fit the RTE.
* @param array Parsed TypoScript content configuring the RTE, probably coming from Page TSconfig.
* @return string Output value
* @see t3lib_TCEmain::fillInFieldArray(), t3lib_transferData::renderRecord_typesProc()
*/
function RTE_transform($value, $specConf, $direction = 'rte', $thisConfig = array())
{
// Init:
$this->tsConfig = $thisConfig;
$this->procOptions = $thisConfig['proc.'];
$this->preserveTags = strtoupper(implode(',', t3lib_div::trimExplode(',', $this->procOptions['preserveTags'])));
// dynamic configuration of blockElementList
if ($this->procOptions['blockElementList']) {
$this->blockElementList = $this->procOptions['blockElementList'];
}
// Get parameters for rte_transformation:
$p = $this->rte_p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
// Setting modes:
if (strcmp($this->procOptions['overruleMode'], '')) {
$modes = array_unique(t3lib_div::trimExplode(',', $this->procOptions['overruleMode']));
} else {
$modes = array_unique(t3lib_div::trimExplode('-', $p['mode']));
}
$revmodes = array_flip($modes);
// Find special modes and extract them:
if (isset($revmodes['ts'])) {
$modes[$revmodes['ts']] = 'ts_transform,ts_preserve,ts_images,ts_links';
}
// Find special modes and extract them:
if (isset($revmodes['ts_css'])) {
$modes[$revmodes['ts_css']] = 'css_transform,ts_images,ts_links';
}
// Make list unique
$modes = array_unique(t3lib_div::trimExplode(',', implode(',', $modes), 1));
// Reverse order if direction is "rte"
if ($direction == 'rte') {
$modes = array_reverse($modes);
}
// Getting additional HTML cleaner configuration. These are applied either before or after the main transformation is done and is thus totally independant processing options you can set up:
$entry_HTMLparser = $this->procOptions['entryHTMLparser_' . $direction] ? $this->HTMLparserConfig($this->procOptions['entryHTMLparser_' . $direction . '.']) : '';
$exit_HTMLparser = $this->procOptions['exitHTMLparser_' . $direction] ? $this->HTMLparserConfig($this->procOptions['exitHTMLparser_' . $direction . '.']) : '';
// Line breaks of content is unified into char-10 only (removing char 13)
if (!$this->procOptions['disableUnifyLineBreaks']) {
$value = str_replace(CRLF, LF, $value);
}
// In an entry-cleaner was configured, pass value through the HTMLcleaner with that:
if (is_array($entry_HTMLparser)) {
$value = $this->HTMLcleaner($value, $entry_HTMLparser[0], $entry_HTMLparser[1], $entry_HTMLparser[2], $entry_HTMLparser[3]);
}
// Traverse modes:
foreach ($modes as $cmd) {
// ->DB
if ($direction == 'db') {
// Checking for user defined transformation:
if ($_classRef = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['transformation'][$cmd]) {
$_procObj = t3lib_div::getUserObj($_classRef);
$_procObj->pObj = $this;
$_procObj->transformationKey = $cmd;
$value = $_procObj->transform_db($value, $this);
} else {
// ... else use defaults:
switch ($cmd) {
case 'ts_images':
$value = $this->TS_images_db($value);
break;
case 'ts_reglinks':
$value = $this->TS_reglinks($value, 'db');
break;
case 'ts_links':
$value = $this->TS_links_db($value);
break;
case 'ts_preserve':
$value = $this->TS_preserve_db($value);
break;
case 'ts_transform':
case 'css_transform':
$value = str_replace(CR, '', $value);
// Has a very disturbing effect, so just remove all '13' - depend on '10'
$this->allowedClasses = t3lib_div::trimExplode(',', $this->procOptions['allowedClasses'], 1);
$value = $this->TS_transform_db($value, $cmd == 'css_transform');
break;
case 'ts_strip':
$value = $this->TS_strip_db($value);
break;
default:
break;
}
}
}
// ->RTE
if ($direction == 'rte') {
// Checking for user defined transformation:
if ($_classRef = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['transformation'][$cmd]) {
$_procObj = t3lib_div::getUserObj($_classRef);
//.........這裏部分代碼省略.........
示例5: RTEtsConfigParams
/**
* @return [type] ...
* @desc
*/
function RTEtsConfigParams()
{
if ($this->is_FE()) {
return '';
} else {
$p = t3lib_BEfunc::getSpecConfParametersFromArray($this->specConf['rte_transform']['parameters']);
return $this->elementParts[0] . ':' . $this->elementParts[1] . ':' . $this->elementParts[2] . ':' . $this->thePid . ':' . $this->typeVal . ':' . $this->tscPID . ':' . $p['imgpath'];
}
}