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


PHP StringUtil::insertTagToSrc方法代码示例

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


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

示例1: insertTagToSrc

 /**
  * Convert insert tags inside "src" attributes to file paths.
  *
  * @param string $data The markup string.
  *
  * @return string The markup with insert tags converted to file paths
  */
 public static function insertTagToSrc($data)
 {
     if (self::isStringUtilAvailable()) {
         return StringUtil::insertTagToSrc($data);
     }
     return \Contao\String::insertTagToSrc($data);
 }
开发者ID:contao-community-alliance,项目名称:events-contao-bindings,代码行数:14,代码来源:StringHelper.php

示例2: row

    /**
     * Render a row of a box and return it as HTML string
     *
     * @param string $strPalette
     *
     * @return string
     *
     * @throws AccessDeniedException
     * @throws \Exception
     */
    protected function row($strPalette = null)
    {
        $arrData = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField];
        // Check if the field is excluded
        if ($arrData['exclude']) {
            throw new AccessDeniedException('Field "' . $this->strTable . '.' . $this->strField . '" is excluded from being edited.');
        }
        $xlabel = '';
        // Toggle line wrap (textarea)
        if ($arrData['inputType'] == 'textarea' && !isset($arrData['eval']['rte'])) {
            $xlabel .= ' ' . \Image::getHtml('wrap.svg', $GLOBALS['TL_LANG']['MSC']['wordWrap'], 'title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['wordWrap']) . '" class="toggleWrap" onclick="Backend.toggleWrap(\'ctrl_' . $this->strInputName . '\')"');
        }
        // Add the help wizard
        if ($arrData['eval']['helpwizard']) {
            $xlabel .= ' <a href="contao/help.php?table=' . $this->strTable . '&amp;field=' . $this->strField . '" title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['helpWizard']) . '" onclick="Backend.openModalIframe({\'width\':735,\'title\':\'' . \StringUtil::specialchars(str_replace("'", "\\'", $arrData['label'][0])) . '\',\'url\':this.href});return false">' . \Image::getHtml('about.svg', $GLOBALS['TL_LANG']['MSC']['helpWizard'], 'style="vertical-align:text-bottom"') . '</a>';
        }
        // Add a custom xlabel
        if (is_array($arrData['xlabel'])) {
            foreach ($arrData['xlabel'] as $callback) {
                if (is_array($callback)) {
                    $this->import($callback[0]);
                    $xlabel .= $this->{$callback[0]}->{$callback[1]}($this);
                } elseif (is_callable($callback)) {
                    $xlabel .= $callback($this);
                }
            }
        }
        // Input field callback
        if (is_array($arrData['input_field_callback'])) {
            $this->import($arrData['input_field_callback'][0]);
            return $this->{$arrData['input_field_callback'][0]}->{$arrData['input_field_callback'][1]}($this, $xlabel);
        } elseif (is_callable($arrData['input_field_callback'])) {
            return $arrData['input_field_callback']($this, $xlabel);
        }
        /** @var Widget $strClass */
        $strClass = $GLOBALS['BE_FFL'][$arrData['inputType']];
        // Return if the widget class does not exists
        if (!class_exists($strClass)) {
            return '';
        }
        $arrData['eval']['required'] = false;
        // Use strlen() here (see #3277)
        if ($arrData['eval']['mandatory']) {
            if (is_array($this->varValue)) {
                if (empty($this->varValue)) {
                    $arrData['eval']['required'] = true;
                }
            } else {
                if (!strlen($this->varValue)) {
                    $arrData['eval']['required'] = true;
                }
            }
        }
        // Convert insert tags in src attributes (see #5965)
        if (isset($arrData['eval']['rte']) && strncmp($arrData['eval']['rte'], 'tiny', 4) === 0) {
            $this->varValue = \StringUtil::insertTagToSrc($this->varValue);
        }
        /** @var Widget $objWidget */
        $objWidget = new $strClass($strClass::getAttributesFromDca($arrData, $this->strInputName, $this->varValue, $this->strField, $this->strTable, $this));
        $objWidget->xlabel = $xlabel;
        $objWidget->currentRecord = $this->intId;
        // Validate the field
        if (\Input::post('FORM_SUBMIT') == $this->strTable) {
            $key = \Input::get('act') == 'editAll' ? 'FORM_FIELDS_' . $this->intId : 'FORM_FIELDS';
            // Calculate the current palette
            $postPaletteFields = implode(',', \Input::post($key));
            $postPaletteFields = array_unique(\StringUtil::trimsplit('[,;]', $postPaletteFields));
            // Compile the palette if there is none
            if ($strPalette === null) {
                $newPaletteFields = \StringUtil::trimsplit('[,;]', $this->getPalette());
            } else {
                // Use the given palette ($strPalette is an array in editAll mode)
                $newPaletteFields = is_array($strPalette) ? $strPalette : \StringUtil::trimsplit('[,;]', $strPalette);
                // Re-check the palette if the current field is a selector field
                if (isset($GLOBALS['TL_DCA'][$this->strTable]['palettes']['__selector__']) && in_array($this->strField, $GLOBALS['TL_DCA'][$this->strTable]['palettes']['__selector__'])) {
                    // If the field value has changed, recompile the palette
                    if ($this->varValue != \Input::post($this->strInputName)) {
                        $newPaletteFields = \StringUtil::trimsplit('[,;]', $this->getPalette());
                    }
                }
            }
            // Adjust the names in editAll mode
            if (\Input::get('act') == 'editAll') {
                foreach ($newPaletteFields as $k => $v) {
                    $newPaletteFields[$k] = $v . '_' . $this->intId;
                }
                if ($this->User->isAdmin) {
                    $newPaletteFields['pid'] = 'pid_' . $this->intId;
                    $newPaletteFields['sorting'] = 'sorting_' . $this->intId;
                }
//.........这里部分代码省略.........
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:101,代码来源:DataContainer.php

示例3: convertUuidToFileSource

 /**
  * Convert uuid to file source to see the right source in the rich text editor.
  * After convert this back to the original source.
  *
  * @param DecodePropertyValueForWidgetEvent $event The event to handle.
  *
  * @return void
  */
 public function convertUuidToFileSource(DecodePropertyValueForWidgetEvent $event)
 {
     $environment = $event->getEnvironment();
     $dataDefinition = $environment->getDataDefinition();
     $propertiesDefinition = $dataDefinition->getPropertiesDefinition();
     $property = $propertiesDefinition->getProperty($event->getProperty());
     if (!array_key_exists('rte', $property->getExtra()) || strpos($property->getExtra()['rte'], 'tiny') !== 0) {
         return;
     }
     $event->setValue(StringUtil::insertTagToSrc($event->getValue()));
 }
开发者ID:contao-community-alliance,项目名称:dc-general,代码行数:19,代码来源:RichTextFileUuidSubscriber.php


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