当前位置: 首页>>代码示例>>PHP>>正文


PHP BackendUtility::getSpecConfParametersFromArray方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::getSpecConfParametersFromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::getSpecConfParametersFromArray方法的具体用法?PHP BackendUtility::getSpecConfParametersFromArray怎么用?PHP BackendUtility::getSpecConfParametersFromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Backend\Utility\BackendUtility的用法示例。


在下文中一共展示了BackendUtility::getSpecConfParametersFromArray方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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 $dirRTE Keyword: "rte" means direction from db to rte, "db" means direction from Rte to DB
  * @param string $value Value to transform.
  * @param string $table The table name
  * @param string $field The field name
  * @param array $row The current row from which field is being rendered
  * @param array $specConf "special" configuration - what is found at position 4 in the types configuration of a field from record, parsed into an array.
  * @param array $thisConfig Configuration for RTEs; A mix between TSconfig and otherwise. Contains configuration for display, which buttons are enabled, additional transformation information etc.
  * @param string $RTErelPath 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 PID value of record (true parent page id)
  * @return string Transformed content
  * @todo Define visibility
  */
 public function transformContent($dirRTE, $value, $table, $field, $row, $specConf, $thisConfig, $RTErelPath, $pid)
 {
     if ($specConf['rte_transform']) {
         $p = \TYPO3\CMS\Backend\Utility\BackendUtility::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
         // There must be a mode set for transformation
         if ($p['mode']) {
             // Initialize transformation:
             $parseHTML = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\RteHtmlParser');
             $parseHTML->init($table . ':' . $field, $pid);
             $parseHTML->setRelPath($RTErelPath);
             // Perform transformation:
             $value = $parseHTML->RTE_transform($value, $specConf, $dirRTE, $thisConfig);
         }
     }
     return $value;
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:34,代码来源:AbstractRte.php

示例2: transformDatabaseContentToEditor

 /**
  * Performs transformation of content from database to richtext editor
  *
  * @param string $value Value to transform.
  * @return string Transformed content
  */
 protected function transformDatabaseContentToEditor($value)
 {
     // change <strong> to <b>
     $value = preg_replace('/<(\\/?)strong/i', '<$1b', $value);
     // change <em> to <i>
     $value = preg_replace('/<(\\/?)em([^b>]*>)/i', '<$1i$2', $value);
     if ($this->defaultExtras['rte_transform']) {
         $parameters = BackendUtility::getSpecConfParametersFromArray($this->defaultExtras['rte_transform']['parameters']);
         // There must be a mode set for transformation
         if ($parameters['mode']) {
             /** @var RteHtmlParser $parseHTML */
             $parseHTML = GeneralUtility::makeInstance(RteHtmlParser::class);
             $parseHTML->init($this->data['table'] . ':' . $this->data['fieldName'], $this->pidOfVersionedMotherRecord);
             $parseHTML->setRelPath('');
             $value = $parseHTML->RTE_transform($value, $this->defaultExtras, 'rte', $this->processedRteConfiguration);
         }
     }
     return $value;
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:25,代码来源:RichTextElement.php

示例3: 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
  */
 public function RTE_transform($value, $specConf, $direction = 'rte', $thisConfig = array())
 {
     // Init:
     $this->tsConfig = $thisConfig;
     $this->procOptions = (array) $thisConfig['proc.'];
     $this->preserveTags = strtoupper(implode(',', GeneralUtility::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 = BackendUtility::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
     // Setting modes:
     if ((string) $this->procOptions['overruleMode'] !== '') {
         $modes = array_unique(GeneralUtility::trimExplode(',', $this->procOptions['overruleMode']));
     } else {
         $modes = array_unique(GeneralUtility::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(GeneralUtility::trimExplode(',', implode(',', $modes), true));
     // 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 independent 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 = GeneralUtility::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':
                         $this->allowedClasses = GeneralUtility::trimExplode(',', $this->procOptions['allowedClasses'], true);
                         // CR has a very disturbing effect, so just remove all CR and rely on LF
                         $value = str_replace(CR, '', $value);
                         // Transform empty paragraphs into spacing paragraphs
                         $value = str_replace('<p></p>', '<p>&nbsp;</p>', $value);
                         // Double any trailing spacing paragraph so that it does not get removed by divideIntoLines()
                         $value = preg_replace('/<p>&nbsp;<\\/p>$/', '<p>&nbsp;</p>' . '<p>&nbsp;</p>', $value);
                         $value = $this->TS_transform_db($value, $cmd == 'css_transform');
                         break;
                     case 'ts_strip':
                         $value = $this->TS_strip_db($value);
                         break;
                     default:
                         // Do nothing
                 }
             }
         }
         // ->RTE
         if ($direction == 'rte') {
//.........这里部分代码省略.........
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:101,代码来源:RteHtmlParser.php

示例4: transformRichtextContentToDatabase

 /**
  * Performs transformation of content from richtext element to database.
  *
  * @param string $value Value to transform.
  * @param string $table The table name
  * @param string $field The field name
  * @param array $defaultExtras Default extras configuration of this field - typically "richtext:rte_transform[mode=ts_css]"
  * @param array $thisConfig Configuration for RTEs; A mix between TSconfig and others. Configuration for additional transformation information
  * @param int $pid PID value of record (true parent page id)
  * @return string Transformed content
  */
 protected function transformRichtextContentToDatabase($value, $table, $field, $defaultExtras, $thisConfig, $pid)
 {
     if ($defaultExtras['rte_transform']) {
         $parameters = BackendUtility::getSpecConfParametersFromArray($defaultExtras['rte_transform']['parameters']);
         // There must be a mode set for transformation, this is typically 'ts_css'
         if ($parameters['mode']) {
             // Initialize transformation:
             $parseHTML = GeneralUtility::makeInstance(RteHtmlParser::class);
             $parseHTML->init($table . ':' . $field, $pid);
             $parseHTML->setRelPath('');
             // Perform transformation:
             $value = $parseHTML->RTE_transform($value, $defaultExtras, 'db', $thisConfig);
         }
     }
     return $value;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:27,代码来源:DataHandler.php

示例5: 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 Table name
  * @param array $row Record row (needed, if there are RTE dependencies based on other fields in the record)
  * @param string $field Field name
  * @return boolean Returns TRUE if the rich text editor would be enabled/available for the field name specified.
  * @todo Define visibility
  */
 public function isRTEforField($table, $row, $field)
 {
     $specConf = $this->getSpecConfForField($table, $row, $field);
     if (!count($specConf)) {
         return FALSE;
     }
     $p = BackendUtility::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
     if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) {
         BackendUtility::fixVersioningPid($table, $row);
         list($tscPID, $thePidValue) = BackendUtility::getTSCpid($table, $row['uid'], $row['pid']);
         // If the pid-value is not negative (that is, a pid could NOT be fetched)
         if ($thePidValue >= 0) {
             if (!isset($this->rteSetup[$tscPID])) {
                 $this->rteSetup[$tscPID] = $this->getBackendUser()->getTSConfig('RTE', BackendUtility::getPagesTSconfig($tscPID));
             }
             $RTEtypeVal = BackendUtility::getTCAtypeValue($table, $row);
             $thisConfig = BackendUtility::RTEsetup($this->rteSetup[$tscPID]['properties'], $table, $field, $RTEtypeVal);
             if (!$thisConfig['disabled']) {
                 return TRUE;
             }
         }
     }
     return FALSE;
 }
开发者ID:allipierre,项目名称:Typo3,代码行数:34,代码来源:PageLayoutView.php

示例6: 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 $table The table name of the record
     * @param string $field The field name which this element is supposed to edit
     * @param array $row The record data array where the value(s) for the field can be found
     * @param array $PA An array with additional configuration options.
     * @return string The HTML code for the TCEform field
     * @todo Define visibility
     */
    public function getSingleField_typeText($table, $field, $row, &$PA)
    {
        // Init config:
        $config = $PA['fieldConf']['config'];
        $evalList = GeneralUtility::trimExplode(',', $config['eval'], TRUE);
        if ($this->renderReadonly || $config['readOnly']) {
            return $this->getSingleField_typeNone_render($config, $PA['itemFormElValue']);
        }
        // Setting columns number:
        $cols = MathUtility::forceIntegerInRange($config['cols'] ? $config['cols'] : 30, 5, $this->maxTextareaWidth);
        // Setting number of rows:
        $origRows = $rows = MathUtility::forceIntegerInRange($config['rows'] ? $config['rows'] : 5, 1, 20);
        if (strlen($PA['itemFormElValue']) > $this->charsPerRow * 2) {
            $cols = $this->maxTextareaWidth;
            $rows = MathUtility::forceIntegerInRange(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:
        // Set TRUE, if the RTE is loaded; If not a normal textarea is shown.
        $RTEwasLoaded = 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...
        $RTEwouldHaveBeenLoaded = 0;
        // "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']) . '" />';
        $item = '';
        // If RTE is generally enabled (TYPO3_CONF_VARS and user settings)
        if ($this->RTEenabled) {
            $p = BackendUtility::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
            // If the field is configured for RTE and if any flag-field is not set to disable it.
            if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) {
                BackendUtility::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 = $this->getBackendUserAuthentication()->getTSConfig('RTE', BackendUtility::getPagesTSconfig($tscPID));
                    $RTEtypeVal = BackendUtility::getTCAtypeValue($table, $row);
                    $thisConfig = BackendUtility::RTEsetup($RTEsetup['properties'], $table, $field, $RTEtypeVal);
                    if (!$thisConfig['disabled']) {
                        if (!$this->disableRTE) {
                            $this->RTEcounter++;
                            // Find alternative relative path for RTE images/links:
                            $eFile = RteHtmlParser::evalWriteFile($specConf['static_write'], $row);
                            $RTErelPath = is_array($eFile) ? dirname($eFile['relEditFile']) : '';
                            // Get RTE object, draw form and set flag:
                            $RTEobj = BackendUtility::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) {
            // Show message, if no RTE (field can only be edited with RTE!)
            if ($specConf['rte_only']) {
                $item = '<p><em>' . htmlspecialchars($this->getLL('l_noRTEfound')) . '</em></p>';
            } else {
                if ($specConf['nowrap']) {
                    $wrap = 'off';
                } else {
                    $wrap = $config['wrap'] ?: 'virtual';
                }
                $classes = array();
                if ($specConf['fixed-font']) {
                    $classes[] = 'fixed-font';
//.........这里部分代码省略.........
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:101,代码来源:FormEngine.php

示例7: RTEtsConfigParams

 /**
  * @return 	[type]		...
  * @desc
  * @todo Define visibility
  */
 public function RTEtsConfigParams()
 {
     if ($this->is_FE()) {
         return '';
     } else {
         $p = BackendUtility::getSpecConfParametersFromArray($this->specConf['rte_transform']['parameters']);
         return $this->elementParts[0] . ':' . $this->elementParts[1] . ':' . $this->elementParts[2] . ':' . $this->thePid . ':' . $this->typeVal . ':' . $this->tscPID . ':' . $p['imgpath'];
     }
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:14,代码来源:RteHtmlAreaBase.php

示例8: RTEtsConfigParams

 /**
  * A list of parameters that is mostly given as GET/POST to other RTE controllers.
  *
  * @return string
  */
 protected function RTEtsConfigParams()
 {
     $parameters = BackendUtility::getSpecConfParametersFromArray($this->defaultExtras['rte_transform']['parameters']);
     $result = array($this->data['tableName'], $this->data['databaseRow']['uid'], $this->data['fieldName'], $this->pidOfVersionedMotherRecord, $this->data['recordTypeValue'], $this->pidOfPageRecord, $parameters['imgpath']);
     return implode(':', $result);
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:11,代码来源:RichTextElement.php


注:本文中的TYPO3\CMS\Backend\Utility\BackendUtility::getSpecConfParametersFromArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。