wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



deslash › WordPress Function

Seit1.5.0
Veraltetn/v
deslash ( $content )
Parameter:
  • (string) $content The content to modify.
    Erforderlich: Ja
Gibt zurück:
  • (string) The de-slashed content.
Definiert in:
Codex:

Filters for content to remove unnecessary slashes.



Quellcode

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