root

Changeset 218

Show
Ignore:
Timestamp:
09/13/08 21:57:48 (2 years ago)
Author:
wbond
Message:

BackwardsCompatibilityBreak - fHTML::checkForBlockLevelHTML() was renamed to fHTML::containsBlockLevelHTML() and fHTML::createLinks() was renamed to fHTML::makeLinks()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fActiveRecord.php

    r214 r218 Hide Line Numbers
    10461046        // Turn like-breaks into breaks for text fields and add links 
    10471047        if ($formatting === TRUE && in_array($column_type, array('varchar', 'char', 'text'))) { 
    1048             return fHTML::createLinks(fHTML::convertNewlines(fHTML::prepare($value))); 
     1048            return fHTML::makeLinks(fHTML::convertNewlines(fHTML::prepare($value))); 
    10491049        } 
    10501050         
  • fHTML.php

    r214 r218 Hide Line Numbers
    2424     * @return boolean  If the content contains a block level tag 
    2525     */ 
    26     static public function checkForBlockLevelHTML($content) 
     26    static public function containsBlockLevelHTML($content) 
    2727    { 
    2828        static $inline_tags = '<a><abbr><acronym><b><big><br><button><cite><code><del><dfn><em><font><i><img><input><ins><kbd><label><q><s><samp><select><small><span><strike><strong><sub><sup><textarea><tt><u><var>'; 
     
    4141        static $inline_tags_minus_br = '<a><abbr><acronym><b><big><button><cite><code><del><dfn><em><font><i><img><input><ins><kbd><label><q><s><samp><select><small><span><strike><strong><sub><sup><textarea><tt><u><var>'; 
    4242        return (strip_tags($content, $inline_tags_minus_br) != $content) ? $content : nl2br($content); 
     43    } 
     44     
     45     
     46    /** 
     47     * Converts all html entities to normal characters, using UTF-8 
     48     *  
     49     * @param  string $content  The content to decode 
     50     * @return string  The decoded content 
     51     */ 
     52    static public function decode($content) 
     53    { 
     54        return html_entity_decode($content, ENT_COMPAT, 'UTF-8'); 
     55    } 
     56     
     57     
     58    /** 
     59     * Converts all special characters to entites, using UTF-8. 
     60     *  
     61     * @param  string $content  The content to encode 
     62     * @return string  The encoded content 
     63     */ 
     64    static public function encode($content) 
     65    { 
     66        return htmlentities($content, ENT_COMPAT, 'UTF-8'); 
    4367    } 
    4468     
     
    5175     * @return string  The content with all URLs converted to HTML link 
    5276     */ 
    53     static public function createLinks($content, $link_text_length=0) 
     77    static public function makeLinks($content, $link_text_length=0) 
    5478    { 
    5579        // Determine what replacement to perform 
     
    110134     
    111135    /** 
    112      * Converts all html entities to normal characters, using UTF-8 
    113      *  
    114      * @param  string $content  The content to decode 
    115      * @return string  The decoded content 
    116      */ 
    117     static public function decode($content) 
    118     { 
    119         return html_entity_decode($content, ENT_COMPAT, 'UTF-8'); 
    120     } 
    121      
    122      
    123     /** 
    124      * Converts all special characters to entites, using UTF-8. 
    125      *  
    126      * @param  string $content  The content to encode 
    127      * @return string  The encoded content 
    128      */ 
    129     static public function encode($content) 
    130     { 
    131         return htmlentities($content, ENT_COMPAT, 'UTF-8'); 
    132     } 
    133      
    134      
    135     /** 
    136136     * Prepares content for display in UTF-8 encoded HTML - allows HTML tags 
    137137     *  
     
    187187         
    188188        $class = ($css_class) ? ' class="' . $css_class . '"' : ''; 
    189         if (self::checkForBlockLevelHTML($content)) { 
     189        if (self::containsBlockLevelHTML($content)) { 
    190190            echo '<div' . $class . '>' . self::prepare($content) . '</div>'; 
    191191        } else { 
  • fPrintableException.php

    r214 r218 Hide Line Numbers
    4242    protected function getCSSClass() 
    4343    { 
    44         // underscorize the current exception class name, extracted from fGrammar::underscorize() to reduce dependencies 
    45         return strtolower(preg_replace('/(?:([a-z0-9A-Z])([A-Z])|([a-zA-Z])([0-9]))/', '\1\3_\2\4', preg_replace('#^f#', '', get_class($this)))); 
     44        return fGrammar::underscorize(preg_replace('#^f#', '', get_class($this))); 
    4645    } 
    4746     
     
    5453    protected function prepare($content) 
    5554    { 
    56         // See if the message has newline characters but not br tags, extracted from fHTML::convertNewlines() to reduce dependencies 
     55        // See if the message has newline characters but not br tags, extracted from fHTML to reduce dependencies 
    5756        static $inline_tags_minus_br = '<a><abbr><acronym><b><big><button><cite><code><del><dfn><em><font><i><img><input><ins><kbd><label><q><s><samp><select><small><span><strike><strong><sub><sup><textarea><tt><u><var>'; 
    5857        $content_with_newlines = (strip_tags($content, $inline_tags_minus_br)) ? $content : nl2br($content); 
    5958         
    60         // Check to see if we have any block-level html, extracted from fHTML::checkForBlockLevelHtml() to reduce dependencies 
     59        // Check to see if we have any block-level html, extracted from fHTML to reduce dependencies 
    6160        $inline_tags = $inline_tags_minus_br . '<br>'; 
    6261        $no_block_html = strip_tags($content, $inline_tags) == $content; 
     
    6463        $content = html_entity_decode($content, ENT_COMPAT, 'UTF-8'); 
    6564         
    66         // This code ensures the output is properly encoded for display in (X)HTML, extracted from fHTML::prepare() to reduce dependencies 
     65        // This code ensures the output is properly encoded for display in (X)HTML, extracted from fHTML to reduce dependencies 
    6766        $reg_exp = "/<\s*\/?\s*[\w:]+(?:\s+[\w:]+(?:\s*=\s*(?:\"[^\"]*?\"|'[^']*?'|[^'\">\s]+))?)*\s*\/?\s*>|&(?:#\d+|\w+);|<\!--.*?-->/"; 
    6867        preg_match_all($reg_exp, $content, $html_matches, PREG_SET_ORDER);