本文整理汇总了PHP中t3lib_BEfunc::RTEgetObj方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_BEfunc::RTEgetObj方法的具体用法?PHP t3lib_BEfunc::RTEgetObj怎么用?PHP t3lib_BEfunc::RTEgetObj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_BEfunc
的用法示例。
在下文中一共展示了t3lib_BEfunc::RTEgetObj方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Main function, rendering the document with the iframe with the RTE in.
*
* @return void
*/
function main()
{
global $BE_USER, $LANG;
// translate id to the workspace version:
if ($versionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->P['table'], $this->P['uid'], 'uid')) {
$this->P['uid'] = $versionRec['uid'];
}
// If all parameters are available:
if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) {
// Getting the raw record (we need only the pid-value from here...)
$rawRec = t3lib_BEfunc::getRecord($this->P['table'], $this->P['uid']);
t3lib_BEfunc::fixVersioningPid($this->P['table'], $rawRec);
// Setting JavaScript, including the pid value for viewing:
$this->doc->JScode = $this->doc->wrapScriptTags('
function jumpToUrl(URL,formEl) { //
if (document.editform) {
if (!TBE_EDITOR.isFormChanged()) {
window.location.href = URL;
} else if (formEl) {
if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
}
} else window.location.href = URL;
}
' . ($this->popView ? t3lib_BEfunc::viewOnClick($rawRec['pid'], '', t3lib_BEfunc::BEgetRootLine($rawRec['pid'])) : '') . '
');
// Initialize TCeforms - for rendering the field:
$tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
$tceforms->initDefaultBEMode();
// Init...
$tceforms->disableWizards = 1;
// SPECIAL: Disables all wizards - we are NOT going to need them.
$tceforms->colorScheme[0] = $this->doc->bgColor;
// SPECIAL: Setting background color of the RTE to ordinary background
// Initialize style for RTE object:
$RTEobj = t3lib_BEfunc::RTEgetObj();
// Getting reference to the RTE object used to render the field!
if ($RTEobj->ID == 'rte') {
$RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;';
// SPECIAL: Setting style for the RTE <DIV> layer containing the IFRAME
}
// Fetching content of record:
$trData = t3lib_div::makeInstance('t3lib_transferData');
$trData->lockRecords = 1;
$trData->fetchRecord($this->P['table'], $this->P['uid'], '');
// Getting the processed record content out:
reset($trData->regTableItems_data);
$rec = current($trData->regTableItems_data);
$rec['uid'] = $this->P['uid'];
$rec['pid'] = $rawRec['pid'];
// TSconfig, setting width:
$fieldTSConfig = $tceforms->setTSconfig($this->P['table'], $rec, $this->P['field']);
if (strcmp($fieldTSConfig['RTEfullScreenWidth'], '')) {
$width = $fieldTSConfig['RTEfullScreenWidth'];
} else {
$width = '100%';
}
// Get the form field and wrap it in the table with the buttons:
$formContent = $tceforms->getSoloField($this->P['table'], $rec, $this->P['field']);
$formContent = '
<!--
RTE wizard:
-->
<table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard">
<tr>
<td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td>
<td></td>
</tr>
</table>';
// Adding hidden fields:
$formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" />
<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />' . t3lib_TCEforms::getHiddenTokenField('tceAction');
// Finally, add the whole setup:
$this->content .= $tceforms->printNeededJSFunctions_top() . $formContent . $tceforms->printNeededJSFunctions();
} else {
// ERROR:
$this->content .= $this->doc->section($LANG->getLL('forms_title'), '<span class="typo3-red">' . $LANG->getLL('table_noData', 1) . '</span>', 0, 1);
}
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
$markers['CONTENT'] = $this->content;
// Build the <body> for the module
$this->content = $this->doc->startPage('');
$this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
$this->content .= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
}
示例2: isRTE
/**
* Returns true if the RTE (Rich Text Editor) can be enabled for the user
* Strictly this is not permissions being checked but rather a series of settings like a loaded extension, browser/client type and a configuration option in ->uc[edit_RTE]
* The reasons for a FALSE return can be found in $this->RTE_errors
*
* @return boolean
*/
function isRTE()
{
global $CLIENT;
// Start:
$this->RTE_errors = array();
if (!$this->uc['edit_RTE']) {
$this->RTE_errors[] = 'RTE is not enabled for user!';
}
if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) {
$this->RTE_errors[] = 'RTE is not enabled in $TYPO3_CONF_VARS["BE"]["RTEenabled"]';
}
// Acquire RTE object:
$RTE = t3lib_BEfunc::RTEgetObj();
if (!is_object($RTE)) {
$this->RTE_errors = array_merge($this->RTE_errors, $RTE);
}
if (!count($this->RTE_errors)) {
return TRUE;
} else {
return FALSE;
}
}
示例3: checkValue_flex_procInData_travDS
/**
* Processing of the sheet/language data array
* When it finds a field with a value the processing is done by ->checkValue_SW() by default but if a call back function name is given that method in this class will be called for the processing instead.
*
* @param array New values (those being processed): Multidimensional Data array for sheet/language, passed by reference!
* @param array Current values: Multidimensional Data array. May be empty array() if not needed (for callBackFunctions)
* @param array Uploaded files array for sheet/language. May be empty array() if not needed (for callBackFunctions)
* @param array Data structure which fits the data array
* @param array A set of parameters to pass through for the calling of the evaluation functions / call back function
* @param string Call back function, default is checkValue_SW(). If $this->callBackObj is set to an object, the callback function in that object is called instead.
* @param [type] $structurePath: ...
* @return void
* @see checkValue_flex_procInData()
*/
function checkValue_flex_procInData_travDS(&$dataValues, $dataValues_current, $uploadedFiles, $DSelements, $pParams, $callBackFunc, $structurePath)
{
if (is_array($DSelements)) {
// For each DS element:
foreach ($DSelements as $key => $dsConf) {
// Array/Section:
if ($DSelements[$key]['type'] == 'array') {
if (is_array($dataValues[$key]['el'])) {
if ($DSelements[$key]['section']) {
$newIndexCounter = 0;
foreach ($dataValues[$key]['el'] as $ik => $el) {
if (is_array($el)) {
if (!is_array($dataValues_current[$key]['el'])) {
$dataValues_current[$key]['el'] = array();
}
$theKey = key($el);
if (is_array($dataValues[$key]['el'][$ik][$theKey]['el'])) {
$this->checkValue_flex_procInData_travDS($dataValues[$key]['el'][$ik][$theKey]['el'], is_array($dataValues_current[$key]['el'][$ik]) ? $dataValues_current[$key]['el'][$ik][$theKey]['el'] : array(), $uploadedFiles[$key]['el'][$ik][$theKey]['el'], $DSelements[$key]['el'][$theKey]['el'], $pParams, $callBackFunc, $structurePath . $key . '/el/' . $ik . '/' . $theKey . '/el/');
// If element is added dynamically in the flexform of TCEforms, we map the ID-string to the next numerical index we can have in that particular section of elements:
// The fact that the order changes is not important since order is controlled by a separately submitted index.
if (substr($ik, 0, 3) == "ID-") {
$newIndexCounter++;
$this->newIndexMap[$ik] = (is_array($dataValues_current[$key]['el']) && count($dataValues_current[$key]['el']) ? max(array_keys($dataValues_current[$key]['el'])) : 0) + $newIndexCounter;
// Set mapping index
$dataValues[$key]['el'][$this->newIndexMap[$ik]] = $dataValues[$key]['el'][$ik];
// Transfer values
unset($dataValues[$key]['el'][$ik]);
// Unset original
}
}
}
}
} else {
if (!isset($dataValues[$key]['el'])) {
$dataValues[$key]['el'] = array();
}
$this->checkValue_flex_procInData_travDS($dataValues[$key]['el'], $dataValues_current[$key]['el'], $uploadedFiles[$key]['el'], $DSelements[$key]['el'], $pParams, $callBackFunc, $structurePath . $key . '/el/');
}
}
} else {
if (is_array($dsConf['TCEforms']['config']) && is_array($dataValues[$key])) {
foreach ($dataValues[$key] as $vKey => $data) {
if ($callBackFunc) {
if (is_object($this->callBackObj)) {
$res = $this->callBackObj->{$callBackFunc}($pParams, $dsConf['TCEforms']['config'], $dataValues[$key][$vKey], $dataValues_current[$key][$vKey], $uploadedFiles[$key][$vKey], $structurePath . $key . '/' . $vKey . '/');
} else {
$res = $this->{$callBackFunc}($pParams, $dsConf['TCEforms']['config'], $dataValues[$key][$vKey], $dataValues_current[$key][$vKey], $uploadedFiles[$key][$vKey], $structurePath . $key . '/' . $vKey . '/');
}
} else {
// Default
list($CVtable, $CVid, $CVcurValue, $CVstatus, $CVrealPid, $CVrecFID, $CVtscPID) = $pParams;
$res = $this->checkValue_SW(array(), $dataValues[$key][$vKey], $dsConf['TCEforms']['config'], $CVtable, $CVid, $dataValues_current[$key][$vKey], $CVstatus, $CVrealPid, $CVrecFID, '', $uploadedFiles[$key][$vKey], array(), $CVtscPID);
// Look for RTE transformation of field:
if ($dataValues[$key]['_TRANSFORM_' . $vKey] == 'RTE' && !$this->dontProcessTransformations) {
// Unsetting trigger field - we absolutely don't want that into the data storage!
unset($dataValues[$key]['_TRANSFORM_' . $vKey]);
if (isset($res['value'])) {
// Calculating/Retrieving some values here:
list(, , $recFieldName) = explode(':', $CVrecFID);
$theTypeString = t3lib_BEfunc::getTCAtypeValue($CVtable, $this->checkValue_currentRecord);
$specConf = t3lib_BEfunc::getSpecConfParts('', $dsConf['TCEforms']['defaultExtras']);
// Find, thisConfig:
$RTEsetup = $this->BE_USER->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($CVtscPID));
$thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'], $CVtable, $recFieldName, $theTypeString);
// Get RTE object, draw form and set flag:
$RTEobj = t3lib_BEfunc::RTEgetObj();
if (is_object($RTEobj)) {
$res['value'] = $RTEobj->transformContent('db', $res['value'], $CVtable, $recFieldName, $this->checkValue_currentRecord, $specConf, $thisConfig, '', $CVrealPid);
} else {
debug('NO RTE OBJECT FOUND!');
}
}
}
}
// Adding the value:
if (isset($res['value'])) {
$dataValues[$key][$vKey] = $res['value'];
}
// Finally, check if new and old values are different (or no .vDEFbase value is found) and if so, we record the vDEF value for diff'ing.
// We do this after $dataValues has been updated since I expect that $dataValues_current holds evaluated values from database (so this must be the right value to compare with).
if (substr($vKey, -9) != '.vDEFbase') {
if ($this->clear_flexFormData_vDEFbase) {
$dataValues[$key][$vKey . '.vDEFbase'] = '';
} elseif ($this->updateModeL10NdiffData && $GLOBALS['TYPO3_CONF_VARS']['BE']['flexFormXMLincludeDiffBase'] && $vKey !== 'vDEF' && (strcmp($dataValues[$key][$vKey], $dataValues_current[$key][$vKey]) || !isset($dataValues_current[$key][$vKey . '.vDEFbase']) || $this->updateModeL10NdiffData === 'FORCE_FFUPD')) {
// Now, check if a vDEF value is submitted in the input data, if so we expect this has been processed prior to this operation (normally the case since those fields are higher in the form) and we can use that:
if (isset($dataValues[$key]['vDEF'])) {
//.........这里部分代码省略.........
示例4: 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']) {
//.........这里部分代码省略.........