Changeset 3385

Show
Ignore:
Timestamp:
08/29/2008 08:57:12 AM (3 months ago)
Author:
Shadowhand
Message:

Updated valid::standard_text to allow punctuation marks. This does make it possible to match single and double quotes, as well as colons, semi-colons, commas, etc. Right and left carats will still not be matched, so HTML strings will fail.

Closes #807, thanks alexsancho.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/classes/valid.php

    r3366 r3385  
    266266         * dashes, periods, and underscores are allowed. 
    267267         * 
    268          * @param   string   $str 
     268         * @param   string   text to check 
    269269         * @return  boolean 
    270270         */ 
    271271        public static function standard_text($str) 
    272272        { 
    273                 return (bool) preg_match('/^[-\pL\pN\pZ_.]++$/uD', (string) $str); 
     273                // pL matches letters 
     274                // pN matches numbers 
     275                // pZ matches whitespace 
     276                // pPc matches underscores 
     277                // pPd matches dashes 
     278                // pPo matches normal puncuation 
     279                return (bool) preg_match('/^[\pL\pN\pZ\p{Pc}\p{Pd}\p{Po}]++$/uD', (string) $str); 
    274280        } 
    275281