Make WordPress Core


Ignore:
Timestamp:
12/12/2004 08:41:19 PM (22 years ago)
Author:
saxmatt
Message:

Axing htmlspecialchars because it double-encodes-encodes. Better error handling around queries.

File:
1 edited

Legend:

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

    r1927 r1940  
    9696    }
    9797    return true;
     98}
     99
     100function wp_specialchars( $text, $quotes = 0 ) {
     101    // Like htmlspecialchars except don't double-encode HTML entities
     102    $text = preg_replace('/&([^#])(?![a-z12]{1,8};)/', '&$1', $text);-
     103    $text = str_replace('<', '&lt;', $text);
     104    $text = str_replace('>', '&gt;', $text);
     105    if ( $quotes ) {
     106        $text = str_replace('"', '&quot;', $text);
     107        $text = str_replace('"', '&#039;', $text);
     108    }
     109    return $text;
    98110}
    99111
Note: See TracChangeset for help on using the changeset viewer.