Make WordPress Core

Changeset 4660


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

Add js_escape and attribute_escape filters.

File:
1 edited

Legend:

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

    r4658 r4660  
    10771077// Escape single quotes, specialchar double quotes, and fix line endings.
    10781078function js_escape($text) {
    1079     $text = wp_specialchars($text, 'double');
    1080     $text = str_replace(''', "'", $text);
    1081     return preg_replace("/\r?\n/", "\\n", addslashes($text));
     1079    $safe_text = wp_specialchars($text, 'double');
     1080    $safe_text = str_replace(''', "'", $safe_text);
     1081    $safe_text = preg_replace("/\r?\n/", "\\n", addslashes($safe_text));
     1082    return apply_filters('js_escape', $safe_text, $text);
    10821083}
    10831084
    10841085// Escaping for HTML attributes
    10851086function attribute_escape($text) {
    1086     return wp_specialchars($text, true);
     1087    $safe_text = wp_specialchars($text, true);
     1088    return apply_filters('attribute_escape', $safe_text, $text);
    10871089}
    10881090
Note: See TracChangeset for help on using the changeset viewer.