WordPress开发者和主题制作者的搜索引擎



deslash ›

Since1.5.0
已弃用n/a
deslash ( $content )
参数:
  • (string) $content The content to modify.
    Required: Yes
返回:
  • (string) The de-slashed content.
定义在:
文档:

Filters for content to remove unnecessary slashes.



源码

function deslash( $content ) {
	// Note: \\\ inside a regex denotes a single backslash.

	/*
	 * Replace one or more backslashes followed by a single quote with
	 * a single quote.
	 */
	$content = preg_replace( "/\\\+'/", "'", $content );

	/*
	 * Replace one or more backslashes followed by a double quote with
	 * a double quote.
	 */
	$content = preg_replace( '/\\\+"/', '"', $content );

	// Replace one or more backslashes with one backslash.
	$content = preg_replace( '/\\\+/', '\\', $content );

	return $content;
}