wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



deslash › WordPress Function

Od1.5.0
Przestarzałyn/a
deslash ( $content )
Parametry:
  • (string) $content The content to modify.
    Wymagane: Tak
Powrót:
  • (string) The de-slashed content.
Zdefiniowane na:
Codex:

Filters for content to remove unnecessary slashes.



Źródło

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