本文整理汇总了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);
}
示例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 . '&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;
}
//.........这里部分代码省略.........
示例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()));
}