deslash()

最后更新于:2021-11-26 01:37:19

deslash( string$content)

Filters for content to remove unnecessary slashes.

参数

$content

(string) (Required) The content to modify.

响应

(string) The de-slashed content.

源文件

文件: gc-admin/includes/upgrade.php

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;
}