Ignore:
Timestamp:
May 13, 2008 4:14:53 AM (16 years ago)
Author:
quinn
Message:

Fixed lots of misplings. I'm so embarrassed! ;P

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Utilities.inc.php

    r331 r334  
    6969 *
    7070 * @param  string $text             Text to clean.
    71  * @param  bool   $preserve_html    If set to true, oTxt will not translage <, >, ", or '
    72  *                                  characters into HTML entities. This allows HTML to pass
    73  *                                  through unmunged.
     71 * @param  bool   $preserve_html    If set to true, oTxt will not translate <, >, ", or '
     72 *                                  characters into HTML entities. This allows HTML to pass through unmunged.
    7473 * @return string                   Cleaned text.
    7574 */
     
    10099    }
    101100
    102     // & becomes &amp;. Exclude any occurance where the & is followed by a alphanum or unicode caracter.
     101    // & becomes &amp;. Exclude any occurrence where the & is followed by a alphanum or unicode character.
    103102    $search['ampersand']        = '/&(?![\w\d#]{1,10};)/';
    104103    $replace['ampersand']       = '&amp;';
    105104
    106     return preg_replace($search, $replace, htmlentities($text, ENT_QUOTES, $app->getParam('character_set')));
    107 }
    108 
    109 /**
    110  * Returns text with stylistic modifications. Warning: this will break some HTML attibutes!
     105    return preg_replace($search, $replace, htmlspecialchars($text, ENT_QUOTES, $app->getParam('character_set')));
     106}
     107
     108/**
     109 * Returns text with stylistic modifications. Warning: this will break some HTML attributes!
    111110 * TODO: Allow a string such as this to be passed: <a href="javascript:openPopup('/foo/bar.php')">Click here</a>
    112111 *
     
    143142
    144143/**
    145  * Applies a class to search terms to highlight them ala-google results.
     144 * Applies a class to search terms to highlight them ala google results.
    146145 *
    147146 * @param  string   $text   Input text to search.
     
    169168
    170169/**
    171  * Generates a hexadecibal html color based on provided word.
     170 * Generates a hexadecimal html color based on provided word.
    172171 *
    173172 * @access public
     
    190189    case 1 :
    191190    default :
    192         // Reduce all hex values slighly to avoid all white.
     191        // Reduce all hex values slightly to avoid all white.
    193192        array_walk($rgb, create_function('&$v', '$v = dechex(round(hexdec($v) * 0.87));'));
    194193        break;
     
    353352
    354353/**
    355  * Tests the existance of a file anywhere in the include path.
     354 * Tests the existence of a file anywhere in the include path.
    356355 *
    357356 * @param   string  $file   File in include path.
     
    440439/**
    441440 * If $var is net set or null, set it to $default. Otherwise leave it alone.
    442  * Returns the final value of $var. Use to find a default value of one is not avilable.
     441 * Returns the final value of $var. Use to find a default value of one is not available.
    443442 *
    444443 * @param  mixed $var       The variable that is being set.
     
    460459 *
    461460 * @param  array $array    input array
    462  * @param  array $delim    optional character that will also be excaped.
     461 * @param  array $delim    optional character that will also be escaped.
    463462 * @return array    an array with the same values as $array1 but shuffled
    464463 */
     
    480479 * Converts a PHP Array into encoded URL arguments and return them as an array.
    481480 *
    482  * @param  mixed $data        An array to transverse recursivly, or a string
     481 * @param  mixed $data        An array to transverse recursively, or a string
    483482 *                            to use directly to create url arguments.
    484483 * @param  string $prefix     The name of the first dimension of the array.
     
    494493    if (is_array($data)) {
    495494        foreach ($data as $key => $val) {
    496             // If the prefix is empty, use the $key as the name of the first dimention of the "array".
    497             // ...otherwise, append the key as a new dimention of the "array".
     495            // If the prefix is empty, use the $key as the name of the first dimension of the "array".
     496            // ...otherwise, append the key as a new dimension of the "array".
    498497            $new_prefix = ('' == $prefix) ? urlencode($key) : $prefix . '[' . urlencode($key) . ']';
    499498            // Enter recursion.
     
    501500        }
    502501    } else {
    503         // We've come to the last dimention of the array, save the "array" and its value.
     502        // We've come to the last dimension of the array, save the "array" and its value.
    504503        $args[$prefix] = urlencode($data);
    505504    }
     
    517516 * Converts a PHP Array into encoded URL arguments and return them in a string.
    518517 *
    519  * @param  mixed $data        An array to transverse recursivly, or a string
     518 * @param  mixed $data        An array to transverse recursively, or a string
    520519 *                            to use directly to create url arguments.
    521  * @param  string $prefix     The name of the first dimention of the array.
     520 * @param  string $prefix     The name of the first dimension of the array.
    522521 *                            If not specified, the first keys of the array will be used.
    523522 * @return string url         A string ready to append to a url.
     
    537536
    538537/**
    539  * Fills an arrray with the result from a multiple ereg search.
    540  * Curtesy of Bruno - rbronosky@mac.com - 10-May-2001
    541  * Blame him for the funky do...while loop.
     538 * Fills an array with the result from a multiple ereg search.
     539 * Courtesy of Bruno - rbronosky@mac.com - 10-May-2001
    542540 *
    543541 * @param  mixed $pattern   regular expression needle
     
    661659/**
    662660 * If magic_quotes_gpc is in use, run stripslashes() on $var. If $var is an
    663  * array, stripslashes is run on each value, recursivly, and the stripped
     661 * array, stripslashes is run on each value, recursively, and the stripped
    664662 * array is returned.
    665663 *
     
    991989 *
    992990 * @param  bool $exclude_query  Remove the query string first before comparing.
    993  * @return bool                 True if the current URL is the same as the refering URL, false otherwise.
     991 * @return bool                 True if the current URL is the same as the referring URL, false otherwise.
    994992 */
    995993function refererIsMe($exclude_query=false)
Note: See TracChangeset for help on using the changeset viewer.