Make WordPress Core

Changeset 4661


Ignore:
Timestamp:
12/22/2006 05:27:45 AM (18 years ago)
Author:
ryan
Message:

Add js_escape and attribute_escape filters.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/wp-includes/functions-formatting.php

    r4657 r4661  
    10471047// Escape single quotes, specialchar double quotes, and fix line endings.
    10481048function js_escape($text) {
    1049     $text = wp_specialchars($text, 'double');
    1050     $text = str_replace(''', "'", $text);
    1051     return preg_replace("/\r?\n/", "\\n", addslashes($text));
     1049    $safe_text = wp_specialchars($text, 'double');
     1050    $safe_text = str_replace(''', "'", $safe_text);
     1051    $safe_text = preg_replace("/\r?\n/", "\\n", addslashes($safe_text));
     1052    return apply_filters('js_escape', $safe_text, $text);
    10521053}
    10531054
    10541055// Escaping for HTML attributes
    10551056function attribute_escape($text) {
    1056     return wp_specialchars($text, true);
     1057    $safe_text = wp_specialchars($text, true);
     1058    return apply_filters('attribute_escape', $safe_text, $text);
    10571059}
    10581060
Note: See TracChangeset for help on using the changeset viewer.