Make WordPress Core


Ignore:
Timestamp:
05/09/2009 07:27:22 AM (15 years ago)
Author:
markjaquith
Message:

esc_js(). Shorter, follows new escaping naming convention.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/formatting.php

    r11215 r11245  
    20552055 * The filter 'js_escape' is also applied here.
    20562056 *
    2057  * @since 2.0.4
     2057 * @since 2.8.0
    20582058 *
    20592059 * @param string $text The text to be escaped.
    20602060 * @return string Escaped text.
    20612061 */
    2062 function js_escape($text) {
     2062function esc_js( $text ) {
    20632063    $safe_text = wp_check_invalid_utf8( $text );
    20642064    $safe_text = wp_specialchars( $safe_text, ENT_COMPAT );
     
    20662066    $safe_text = preg_replace( "/\r?\n/", "\\n", addslashes( $safe_text ) );
    20672067    return apply_filters( 'js_escape', $safe_text, $text );
     2068}
     2069
     2070/**
     2071 * Escape single quotes, specialchar double quotes, and fix line endings.
     2072 *
     2073 * The filter 'js_escape' is also applied by esc_js()
     2074 *
     2075 * @since 2.0.4
     2076 *
     2077 * @deprecated 2.8.0
     2078 * @see esc_js()
     2079 *
     2080 * @param string $text The text to be escaped.
     2081 * @return string Escaped text.
     2082 */
     2083function js_escape( $text ) {
     2084    return esc_js( $text );
    20682085}
    20692086
Note: See TracChangeset for help on using the changeset viewer.