Changeset 308 for trunk/trax/vendor/trax/inflections.php
- Timestamp:
- 03/19/09 10:40:34 (3 years ago)
- Files:
-
- 1 modified
-
trunk/trax/vendor/trax/inflections.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/trax/vendor/trax/inflections.php
r201 r308 81 81 Inflections::irregular('sex', 'sexes'); 82 82 Inflections::irregular('move', 'moves'); 83 Inflections::irregular('cow', 'kine'); 83 84 84 85 Inflections::uncountable('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep'); … … 94 95 class Inflections { 95 96 96 public static $plurals = array();97 98 public static $singulars = array(); 99 100 public static $uncountables = array();97 public static 98 $plurals = array(), 99 $singulars = array(), 100 $uncountables = array(), 101 $humans = array(); 101 102 102 103 # Specifies a new pluralization rule and its replacement. The rule can either be a string or a regular expression. … … 130 131 # Inflections::uncountable(array("money", "information", "rice")) 131 132 function uncountable() { 132 $args = func_get_args();133 $args = func_get_args(); 133 134 if(is_array($args[0])) { 134 135 $args = $args[0]; … … 137 138 self::$uncountables[] = $word; 138 139 } 140 } 141 142 # Specifies a humanized form of a string by a regular expression rule or by a string mapping. 143 # When using a regular expression based replacement, the normal humanize formatting is called after the replacement. 144 # When a string is used, the human form should be specified as desired (example: 'The name', not 'the_name') 145 # 146 # Examples: 147 # Inflections::human("/_cnt$/i", "\1_count") 148 # Inflections::human("legacy_col_person_name", "Name") 149 function human($rule, $replacement) { 150 array_unshift(self::$humans, array("rule" => $rule, "replacement" => $replacement)); 139 151 } 140 152 … … 147 159 function clear($scope = "all") { 148 160 if($scope == "all") { 149 self::$plurals = self::$singulars = self::$uncountables = array();161 self::$plurals = self::$singulars = self::$uncountables = self::$humans = array(); 150 162 } else { 151 163 self::$$scope = array();
