WordPress函数文档format_to_edit()
对内容执行htmlspecialchars操作,转化成 HTML 实体 描述 译文 处理将要被编辑的文本。 $…
对内容执行htmlspecialchars操作,转化成 HTML 实体
描述
译文
处理将要被编辑的文本。
$richedit未赋值时只是一个存储“format_to_edit”过滤器的文件夹。如果$richedit被设为true,那么 htmlspecialchar会在文本上运行并将特定字符转换为 HTML实体。
原文
如果参数 $richedit 为 false,format_to_post() 这个函数仅仅包含了一个名为 format_to_edit 的 fliter。
如果参数 $richedit 为 true,则它将继续对内容执行 htmlspecialchars 操作,转化成 HTML 实体。
用法
<?php format_to_edit( $content, $richedit ) ?>
参数
$content
(string) (必填) 将编辑的文本
默认值: None
$richedit
(boolean) (可选) 是否 $content 将进行 htmlspecialchars 操作。
默认值: false
返回值
(string)
编辑之后的文本。
历史
添加于 版本: 0.71
源文件
format_to_edit() 函数的代码位于 wp-includes/formatting.php.
| 
 1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
 | 
 /* ———————————- 
 * wordpress函数 kim收集 
 * ———————————- */ 
/** 
 * 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;
 
} 
 | 
- 原文:http://codex.wordpress.org/Function_Reference/format_to_edit
 
类别:WordPress函数文档、 
		本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

评论功能已经关闭!