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


PHP StringUtil::srcToInsertTag方法代码示例

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


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

示例1: convertFileSourceToUuid

 /**
  * Convert file source to uuid before save the model.
  * After convert this is an insert tag {{file::uuid}}.
  *
  * @param EncodePropertyValueFromWidgetEvent $event The event to handle.
  *
  * @return void
  */
 public function convertFileSourceToUuid(EncodePropertyValueFromWidgetEvent $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::srcToInsertTag($event->getValue()));
 }
开发者ID:contao-community-alliance,项目名称:dc-general,代码行数:19,代码来源:RichTextFileUuidSubscriber.php

示例2: row


//.........这里部分代码省略.........
                    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;
                }
            }
            $paletteFields = array_intersect($postPaletteFields, $newPaletteFields);
            // Validate and save the field
            if (in_array($this->strInputName, $paletteFields) || \Input::get('act') == 'overrideAll') {
                $objWidget->validate();
                if ($objWidget->hasErrors()) {
                    // Skip mandatory fields on auto-submit (see #4077)
                    if (\Input::post('SUBMIT_TYPE') != 'auto' || !$objWidget->mandatory || $objWidget->value != '') {
                        $this->noReload = true;
                    }
                } elseif ($objWidget->submitInput()) {
                    $varValue = $objWidget->value;
                    // Sort array by key (fix for JavaScript wizards)
                    if (is_array($varValue)) {
                        ksort($varValue);
                        $varValue = serialize($varValue);
                    }
                    // Convert file paths in src attributes (see #5965)
                    if ($varValue && isset($arrData['eval']['rte']) && strncmp($arrData['eval']['rte'], 'tiny', 4) === 0) {
                        $varValue = \StringUtil::srcToInsertTag($varValue);
                    }
                    // Save the current value
                    try {
                        $this->save($varValue);
                    } catch (\Exception $e) {
                        $this->noReload = true;
                        $objWidget->addError($e->getMessage());
                    }
                }
            }
        }
        $wizard = '';
        $strHelpClass = '';
        // Date picker
        if ($arrData['eval']['datepicker']) {
            $rgxp = $arrData['eval']['rgxp'];
            $format = \Date::formatToJs(\Config::get($rgxp . 'Format'));
            switch ($rgxp) {
                case 'datim':
                    $time = ",\n      timePicker:true";
                    break;
                case 'time':
                    $time = ",\n      pickOnly:\"time\"";
                    break;
                default:
                    $time = '';
                    break;
            }
            $wizard .= ' ' . \Image::getHtml('assets/datepicker/images/icon.svg', '', 'title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['datepicker']) . '" id="toggle_' . $objWidget->id . '" style="cursor:pointer"') . '
  <script>
    window.addEvent("domready", function() {
      new Picker.Date($("ctrl_' . $objWidget->id . '"), {
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:67,代码来源:DataContainer.php

示例3: srcToInsertTag

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


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