WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/13/2010 07:28:19 AM (11 years ago)
Author:
nacin
Message:

Deprecate old l10n and sanitization APIs. Deprecate ngettext() for _n(), ngettext_noop() for _n_noop(), translate_with_context() for _x(). Deprecate sanitize_url for esc_url_raw, js_escape for esc_js, wp_specialchars for esc_html, attribute_escape for esc_attr. See #11388

File:
1 edited

Legend:

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

    r13093 r13096  
    18631863function _c( $text, $domain = 'default' ) {
    18641864    _deprecated_function( __FUNCTION__, '2.9', '_x()' );
    1865     return translate_with_context( $text, $domain );
     1865    return before_last_bar( translate( $text, $domain ) );
     1866}
     1867
     1868/**
     1869 * Translates $text like translate(), but assumes that the text
     1870 * contains a context after its last vertical bar.
     1871 *
     1872 * @since 2.5
     1873 * @uses translate()
     1874 * @deprecated 3.0.0
     1875 * @deprecated Use _x()
     1876 * @see _x()
     1877 *
     1878 * @param string $text Text to translate
     1879 * @param string $domain Domain to retrieve the translated text
     1880 * @return string Translated text
     1881 */
     1882function translate_with_context( $text, $domain = 'default' ) {
     1883    _deprecated_function( __FUNCTION__, '2.9', '_x()' );
     1884    return before_last_bar( translate( $text, $domain ) );
    18661885}
    18671886
     
    18811900    _deprecated_function( __FUNCTION__, '2.9', '_nx()' );
    18821901    return before_last_bar( _n( $single, $plural, $number, $domain ) );
     1902}
     1903
     1904/**
     1905 * Retrieve the plural or single form based on the amount.
     1906 *
     1907 * @since 1.2.0
     1908 * @deprecated 2.8.0
     1909 * @deprecated Use _n()
     1910 * @see _n()
     1911 */
     1912function __ngettext() {
     1913    _deprecated_function( __FUNCTION__, '2.8', '_n()' );
     1914    $args = func_get_args();
     1915    return call_user_func_array('_n', $args);
     1916}
     1917
     1918/**
     1919 * Register plural strings in POT file, but don't translate them.
     1920 *
     1921 * @since 2.5
     1922 * @deprecated 2.8.0
     1923 * @deprecated Use _n_noop()
     1924 * @see _n_noop()
     1925 */
     1926function __ngettext_noop() {
     1927    _deprecated_function( __FUNCTION__, '2.8', '_n_noop()' );
     1928    $args = func_get_args();
     1929    return call_user_func_array('_n_noop', $args);
     1930
    18831931}
    18841932
     
    20752123}
    20762124
     2125/**
     2126 * Performs esc_url() for database or redirect usage.
     2127 *
     2128 * @since 2.3.1
     2129 * @deprecated 2.8.0
     2130 * @deprecated Use esc_url_raw()
     2131 * @see esc_url_raw()
     2132 *
     2133 * @param string $url The URL to be cleaned.
     2134 * @param array $protocols An array of acceptable protocols.
     2135 * @return string The cleaned URL.
     2136 */
     2137function sanitize_url( $url, $protocols = null ) {
     2138    _deprecated_function( __FUNCTION__, '2.8', 'esc_url_raw()' );
     2139    return clean_url( $url, $protocols, 'db' );
     2140}
     2141
     2142/**
     2143 * Escape single quotes, specialchar double quotes, and fix line endings.
     2144 *
     2145 * The filter 'js_escape' is also applied by esc_js()
     2146 *
     2147 * @since 2.0.4
     2148 * @deprecated 2.8.0
     2149 * @deprecated Use esc_js()
     2150 * @see esc_js()
     2151 *
     2152 * @param string $text The text to be escaped.
     2153 * @return string Escaped text.
     2154 */
     2155function js_escape( $text ) {
     2156    _deprecated_function( __FUNCTION__, '2.8', 'esc_js()' );
     2157    return esc_js( $text );
     2158}
     2159
     2160/**
     2161 * Escaping for HTML blocks.
     2162 *
     2163 * @deprecated 2.8.0
     2164 * @deprecated Use esc_html()
     2165 * @see esc_html()
     2166 */
     2167function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
     2168    _deprecated_function( __FUNCTION__, '2.8', 'esc_html()' );
     2169    if ( func_num_args() > 1 ) { // Maintain backwards compat for people passing additional args
     2170        $args = func_get_args();
     2171        return call_user_func_array( '_wp_specialchars', $args );
     2172    } else {
     2173        return esc_html( $string );
     2174    }
     2175}
     2176
     2177
     2178/**
     2179 * Escaping for HTML attributes.
     2180 *
     2181 * @since 2.0.6
     2182 * @deprecated 2.8.0
     2183 * @deprecated Use esc_attr()
     2184 * @see esc_attr()
     2185 *
     2186 * @param string $text
     2187 * @return string
     2188 */
     2189function attribute_escape( $text ) {
     2190    _deprecated_function( __FUNCTION__, '2.8', 'esc_attr()' );
     2191    return esc_attr( $text );
     2192}
     2193
    20772194?>
Note: See TracChangeset for help on using the changeset viewer.