本文整理汇总了PHP中StringUtil::insertTagToSrc方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::insertTagToSrc方法的具体用法?PHP StringUtil::insertTagToSrc怎么用?PHP StringUtil::insertTagToSrc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtil
的用法示例。
在下文中一共展示了StringUtil::insertTagToSrc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listQuestions
/**
* Add the type of input field
*
* @param array $arrRow
*
* @return string
*/
public function listQuestions($arrRow)
{
$key = $arrRow['published'] ? 'published' : 'unpublished';
$date = Date::parse(Config::get('datimFormat'), $arrRow['tstamp']);
return '
<div class="cte_type ' . $key . '"><strong>' . $arrRow['question'] . '</strong> - ' . $date . '</div>
<div class="limit_height' . (!Config::get('doNotCollapse') ? ' h52' : '') . '">
' . StringUtil::insertTagToSrc($arrRow['answer']) . '
</div>' . "\n";
}
示例2: listNewsletters
/**
* List records
*
* @param array $arrRow
*
* @return string
*/
public function listNewsletters($arrRow)
{
return '
<div class="cte_type ' . ($arrRow['sent'] && $arrRow['date'] ? 'published' : 'unpublished') . '"><strong>' . $arrRow['subject'] . '</strong> - ' . ($arrRow['sent'] && $arrRow['date'] ? sprintf($GLOBALS['TL_LANG']['tl_newsletter']['sentOn'], Date::parse(Config::get('datimFormat'), $arrRow['date'])) : $GLOBALS['TL_LANG']['tl_newsletter']['notSent']) . '</div>
<div class="limit_height' . (!Config::get('doNotCollapse') ? ' h128' : '') . '">' . (!$arrRow['sendText'] ? '
' . StringUtil::insertTagToSrc($arrRow['content']) . '<hr>' : '') . '
<pre style="white-space:pre-wrap">' . $arrRow['text'] . '</pre>
</div>' . "\n";
}
示例3: listFormFields
/**
* Add the type of input field
*
* @param array $arrRow
*
* @return string
*/
public function listFormFields($arrRow)
{
$arrRow['required'] = $arrRow['mandatory'];
$key = $arrRow['invisible'] ? 'unpublished' : 'published';
$strType = '
<div class="cte_type ' . $key . '">' . $GLOBALS['TL_LANG']['FFL'][$arrRow['type']][0] . ($arrRow['name'] ? ' (' . $arrRow['name'] . ')' : '') . '</div>
<div class="limit_height' . (!Config::get('doNotCollapse') ? ' h32' : '') . '">';
$strClass = $GLOBALS['TL_FFL'][$arrRow['type']];
if (!class_exists($strClass)) {
return '';
}
/** @var Widget $objWidget */
$objWidget = new $strClass($arrRow);
$strWidget = $objWidget->parse();
$strWidget = preg_replace('/ name="[^"]+"/i', '', $strWidget);
$strWidget = str_replace(array(' type="submit"', ' autofocus', ' required'), array(' type="button"', '', ''), $strWidget);
if ($objWidget instanceof FormHidden) {
return $strType . "\n" . $objWidget->value . "\n</div>\n";
}
return $strType . StringUtil::insertTagToSrc($strWidget) . '
</div>' . "\n";
}
示例4: row
/**
* Render a row of a box and return it as HTML string
*
* @param string $strPalette
*
* @return string
*
* @throws \Exception
*/
protected function row($strPalette = null)
{
$arrData = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField];
// Redirect if the field is excluded
if ($arrData['exclude']) {
$this->log('Field "' . $this->strField . '" of table "' . $this->strTable . '" was excluded from being edited', __METHOD__, TL_ERROR);
$this->redirect('contao/main.php?act=error');
}
$xlabel = '';
// Toggle line wrap (textarea)
if ($arrData['inputType'] == 'textarea' && !isset($arrData['eval']['rte'])) {
$xlabel .= ' ' . \Image::getHtml('wrap.gif', $GLOBALS['TL_LANG']['MSC']['wordWrap'], 'title="' . 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="' . specialchars($GLOBALS['TL_LANG']['MSC']['helpWizard']) . '" onclick="Backend.openModalIframe({\'width\':735,\'height\':405,\'title\':\'' . specialchars(str_replace("'", "\\'", $arrData['label'][0])) . '\',\'url\':this.href});return false">' . \Image::getHtml('about.gif', $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(trimsplit('[,;]', $postPaletteFields));
// Compile the palette if there is none
if ($strPalette === null) {
$newPaletteFields = trimsplit('[,;]', $this->getPalette());
} else {
// Use the given palette ($strPalette is an array in editAll mode)
$newPaletteFields = is_array($strPalette) ? $strPalette : 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 = 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;
}
//.........这里部分代码省略.........
示例5: addCteType
/**
* Add the type of content element
*
* @param array $arrRow
*
* @return string
*/
public function addCteType($arrRow)
{
$key = $arrRow['invisible'] ? 'unpublished' : 'published';
$type = $GLOBALS['TL_LANG']['CTE'][$arrRow['type']][0] ?: ' ';
$class = 'limit_height';
// Remove the class if it is a wrapper element
if (in_array($arrRow['type'], $GLOBALS['TL_WRAPPERS']['start']) || in_array($arrRow['type'], $GLOBALS['TL_WRAPPERS']['separator']) || in_array($arrRow['type'], $GLOBALS['TL_WRAPPERS']['stop'])) {
$class = '';
if (($group = $this->getContentElementGroup($arrRow['type'])) !== null) {
$type = $GLOBALS['TL_LANG']['CTE'][$group] . ' (' . $type . ')';
}
} elseif (in_array($arrRow['type'], $GLOBALS['TL_WRAPPERS']['single'])) {
if (($group = $this->getContentElementGroup($arrRow['type'])) !== null) {
$type = $GLOBALS['TL_LANG']['CTE'][$group] . ' (' . $type . ')';
}
}
// Add the ID of the aliased element
if ($arrRow['type'] == 'alias') {
$type .= ' ID ' . $arrRow['cteAlias'];
}
// Add the protection status
if ($arrRow['protected']) {
$type .= ' (' . $GLOBALS['TL_LANG']['MSC']['protected'] . ')';
} elseif ($arrRow['guests']) {
$type .= ' (' . $GLOBALS['TL_LANG']['MSC']['guests'] . ')';
}
// Add the headline level (see #5858)
if ($arrRow['type'] == 'headline') {
if (is_array($headline = StringUtil::deserialize($arrRow['headline']))) {
$type .= ' (' . $headline['unit'] . ')';
}
}
// Limit the element's height
if (!Config::get('doNotCollapse')) {
$class .= ' h64';
}
$objModel = new ContentModel();
$objModel->setRow($arrRow);
return '
<div class="cte_type ' . $key . '">' . $type . '</div>
<div class="' . trim($class) . '">
' . StringUtil::insertTagToSrc($this->getContentElement($objModel)) . '
</div>' . "\n";
}