format_to_edit()
format_to_edit( string $content, bool $rich_text = fals…
format_to_edit( string $content, bool $rich_text = false )
对即将编辑的文本执行操作。
Acts on text which is about to be edited.
目录锚点:#说明#参数#返回#源码#笔记
说明(Description)
$content通过escu textarea()运行,它使用htmlspecialchars()将特殊字符转换为HTML实体。如果$richedit设置为true,则它只是“format_to_edit”筛选器的持有者。
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $content | (string) | 必需 | 要编辑的文本。 |
| $rich_text | (bool) | 可选 | $content是否应被视为富文本,在这种情况下,它不会通过escu textarea()传递。 |
返回(Return)
(string)运行筛选器(可能还有htmlspecialchars(string))之后的文本。
源码(Source)
/**
* Acts on text which is about to be edited.
*
* The $content is run through esc_textarea(), which uses htmlspecialchars()
* to convert special characters to HTML entities. If $richedit is set to true,
* it is simply a holder for the 'format_to_edit' filter.
*
* @since 0.71
*
* @param string $content The text about to be edited.
* @param bool $richedit Whether the $content should not pass through htmlspecialchars(). Default false (meaning it will be passed).
* @return string The text after the filter (and possibly htmlspecialchars()) has been run.
*/
function format_to_edit( $content, $richedit = false ) {
/**
* Filter the text to be formatted for editing.
*
* @since 1.2.0
*
* @param string $content The text, prior to formatting for editing.
*/
$content = apply_filters( 'format_to_edit', $content );
if ( ! $richedit )
$content = esc_textarea( $content );
return $content;
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 4.4.0 | wp-includes/formatting.php:2624 | 2 | 3 |
笔记(Notes)
$richedit应该在第一段中$rich_文本。
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。



还没有任何评论,赶紧来占个楼吧!