From d5c981b0ead93e1bd02e5e219a6fceea135e3bed Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Fri, 29 May 2009 20:31:52 +0000 Subject: [PATCH] Add esc_sql(), for completeness. git-svn-id: https://develop.svn.wordpress.org/trunk@11490 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index cd3d723632..6c363bab2e 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -2061,6 +2061,21 @@ function clean_url( $url, $protocols = null, $context = 'display' ) { return apply_filters('clean_url', $url, $original_url, $context); } +/** + * Escapes data for use in a MySQL query + * + * This is just a handy shortcut for $wpdb->escape(), for completeness' sake + * + * @since 2.8.0 + * @param string $sql Unescaped SQL data + * @return string The cleaned $sql + */ +function esc_sql( $sql ) { + global $wpdb; + return $wpdb->escape( $sql ); +} + + /** * Checks and cleans a URL. *