CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 1.3 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 1.3
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Classes

  • AclBase
  • AclBehavior
  • AclComponent
  • AclNode
  • AclShell
  • Aco
  • AcoAction
  • AjaxHelper
  • ApcEngine
  • ApiShell
  • App
  • AppController
  • AppHelper
  • AppModel
  • Aro
  • AuthComponent
  • BakeShell
  • BakeTask
  • BehaviorCollection
  • Cache
  • CacheEngine
  • CacheHelper
  • CakeErrorController
  • CakeLog
  • CakeRoute
  • CakeSchema
  • CakeSession
  • CakeSocket
  • ClassRegistry
  • Component
  • Configure
  • ConnectionManager
  • ConsoleShell
  • ContainableBehavior
  • Controller
  • ControllerTask
  • CookieComponent
  • DataSource
  • DbAcl
  • DbConfigTask
  • DboMssql
  • DboMysql
  • DboMysqlBase
  • DboMysqli
  • DboOracle
  • DboPostgres
  • DboSource
  • DboSqlite
  • Debugger
  • EmailComponent
  • ErrorHandler
  • ExtractTask
  • File
  • FileEngine
  • FileLog
  • FixtureTask
  • Folder
  • FormHelper
  • Helper
  • HtmlHelper
  • HttpSocket
  • I18n
  • I18nModel
  • I18nShell
  • Inflector
  • IniAcl
  • JavascriptHelper
  • JqueryEngineHelper
  • JsBaseEngineHelper
  • JsHelper
  • L10n
  • MagicDb
  • MagicFileResource
  • MediaView
  • MemcacheEngine
  • Model
  • ModelBehavior
  • ModelTask
  • MootoolsEngineHelper
  • Multibyte
  • NumberHelper
  • Object
  • Overloadable
  • Overloadable2
  • PagesController
  • PaginatorHelper
  • Permission
  • PluginShortRoute
  • PluginTask
  • ProjectTask
  • PrototypeEngineHelper
  • RequestHandlerComponent
  • Router
  • RssHelper
  • Sanitize
  • Scaffold
  • ScaffoldView
  • SchemaShell
  • Security
  • SecurityComponent
  • SessionComponent
  • SessionHelper
  • Set
  • Shell
  • String
  • TemplateTask
  • TestSuiteShell
  • TestTask
  • TextHelper
  • ThemeView
  • TimeHelper
  • TranslateBehavior
  • TreeBehavior
  • Validation
  • View
  • ViewTask
  • XcacheEngine
  • Xml
  • XmlElement
  • XmlHelper
  • XmlManager
  • XmlNode
  • XmlTextNode

Functions

  • mb_encode_mimeheader
  • mb_stripos
  • mb_stristr
  • mb_strlen
  • mb_strpos
  • mb_strrchr
  • mb_strrichr
  • mb_strripos
  • mb_strrpos
  • mb_strstr
  • mb_strtolower
  • mb_strtoupper
  • mb_substr
  • mb_substr_count

Class Inflector

Pluralize and singularize English words.

Inflector pluralizes and singularizes English nouns. Used by Cake's naming conventions throughout the framework.

Package: cake\cake\libs
Link: http://book.cakephp.org/1.3/en/The-Manual/Core-Utility-Libraries/Inflector.html#Inflector
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: inflector.php

Properties summary

  • $_camelize public
    array
    Cached Camelize Inflections
  • $_classify public
    array
    Classify cached inflecctions
  • $_humanize public
    array
    Humanize cached inflections
  • $_plural public
    array
    Plural inflector rules
  • $_pluralized public
    array
    Cached array identity map of pluralized words.
  • $_singular public
    array
    Singular inflector rules
  • $_singularized public
    array
    Cached array identity map of singularized words.
  • $_tableize public
    array
    Tablize cached inflections
  • $_transliteration public
    array
    Default map of accented and special characters to ASCII characters
  • $_underscore public
    array
    Cached Underscore Inflections
  • $_uninflected public
    array
    Words that should not be inflected

Method Summary

  • _cache() public
    Cache inflected values, and return if already available
  • camelize() public
    Returns the given lower_case_and_underscored_word as a CamelCased word.
  • classify() public
    Returns Cake model class name ("Person" for the database table "people".) for given database table.
  • getInstance() public
    Gets a reference to the Inflector object instance
  • humanize() public

    Returns the given underscored_word_group as a Human Readable Word Group. (Underscores are replaced by spaces and capitalized following words.)

  • pluralize() public
    Return $word in plural form.
  • rules() public
    Adds custom inflection $rules, of either 'plural', 'singular' or 'transliteration' $type.
  • singularize() public
    Return $word in singular form.
  • slug() public deprecated

    Returns a string with all spaces converted to underscores (by default), accented characters converted to non-accented characters, and non word characters removed.

  • tableize() public
    Returns corresponding table name for given model $className. ("people" for the model class "Person").
  • underscore() public
    Returns the given camelCasedWord as an underscored_word.
  • variable() public
    Returns camelBacked version of an underscored string.

Method Detail

_cache() public ¶

_cache( string $type , string $key , string $value = false )

Cache inflected values, and return if already available

Parameters
string $type
Inflection type
string $key
Original value
string $value optional false
Inflected value
Returns
string
Inflected value, from cache

camelize() public ¶

camelize( string $lowerCaseAndUnderscoredWord )

Returns the given lower_case_and_underscored_word as a CamelCased word.

Parameters
string $lowerCaseAndUnderscoredWord
$lower_case_and_underscored_word Word to camelize
Returns
string
Camelized word. LikeThis.
Link
http://book.cakephp.org/1.3/en/The-Manual/Core-Utility-Libraries/Inflector.html#Class-methods

classify() public ¶

classify( string $tableName )

Returns Cake model class name ("Person" for the database table "people".) for given database table.

Parameters
string $tableName
Name of database table to get class name for
Returns
string
Class name
Link
http://book.cakephp.org/1.3/en/The-Manual/Core-Utility-Libraries/Inflector.html#Class-methods

getInstance() public ¶

getInstance( )

Gets a reference to the Inflector object instance

Returns
object

humanize() public ¶

humanize( string $lowerCaseAndUnderscoredWord )

Returns the given underscored_word_group as a Human Readable Word Group. (Underscores are replaced by spaces and capitalized following words.)

Parameters
string $lowerCaseAndUnderscoredWord
$lower_case_and_underscored_word String to be made more readable
Returns
string
Human-readable string
Link
http://book.cakephp.org/1.3/en/The-Manual/Core-Utility-Libraries/Inflector.html#Class-methods

pluralize() public ¶

pluralize( string $word )

Return $word in plural form.

Parameters
string $word
Word in singular
Returns
string
Word in plural
Link
http://book.cakephp.org/1.3/en/The-Manual/Core-Utility-Libraries/Inflector.html#Class-methods

rules() public ¶

rules( string $type , array $rules , boolean $reset = false )

Adds custom inflection $rules, of either 'plural', 'singular' or 'transliteration' $type.

Usage:

{{{ Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables')); Inflector::rules('plural', array( 'rules' => array('/^(inflect)ors$/i' => '\1ables'), 'uninflected' => array('dontinflectme'), 'irregular' => array('red' => 'redlings') )); Inflector::rules('transliteration', array('/å/' => 'aa')); }}}

Parameters
string $type
The type of inflection, either 'plural', 'singular' or 'transliteration'
array $rules
Array of rules to be added.
boolean $reset optional false

If true, will unset default inflections for all new rules that are being defined in $rules.

singularize() public ¶

singularize( string $word )

Return $word in singular form.

Parameters
string $word
Word in plural
Returns
string
Word in singular
Link
http://book.cakephp.org/1.3/en/The-Manual/Core-Utility-Libraries/Inflector.html#Class-methods

slug() public deprecated ¶

slug( string $string , string $replacement = '_' , array $map = array() )

Returns a string with all spaces converted to underscores (by default), accented characters converted to non-accented characters, and non word characters removed.

Deprecated
$map param will be removed in future versions. Use Inflector::rules() instead
Parameters
string $string
the string you want to slug
string $replacement optional '_'
will replace keys in map
array $map optional array()
extra elements to map to the replacement
Returns
string
Link
http://book.cakephp.org/1.3/en/The-Manual/Core-Utility-Libraries/Inflector.html#Class-methods

tableize() public ¶

tableize( string $className )

Returns corresponding table name for given model $className. ("people" for the model class "Person").

Parameters
string $className
Name of class to get database table name for
Returns
string
Name of the database table for given class
Link
http://book.cakephp.org/1.3/en/The-Manual/Core-Utility-Libraries/Inflector.html#Class-methods

underscore() public ¶

underscore( string $camelCasedWord )

Returns the given camelCasedWord as an underscored_word.

Parameters
string $camelCasedWord
Camel-cased word to be "underscorized"
Returns
string
Underscore-syntaxed version of the $camelCasedWord
Link
http://book.cakephp.org/1.3/en/The-Manual/Core-Utility-Libraries/Inflector.html#Class-methods

variable() public ¶

variable( string $string )

Returns camelBacked version of an underscored string.

Parameters
string $string
Returns
string
in variable form
Link
http://book.cakephp.org/1.3/en/The-Manual/Core-Utility-Libraries/Inflector.html#Class-methods

Properties detail

$_camelize ¶

public array

Cached Camelize Inflections

array()

$_classify ¶

public array

Classify cached inflecctions

array()

$_humanize ¶

public array

Humanize cached inflections

array()

$_plural ¶

public array

Plural inflector rules

array(
    'rules' => array(
        '/(s)tatus$/i' => '\1\2tatuses',
        '/(quiz)$/i' => '\1zes',
        '/^(ox)$/i' => '\1\2en',
        '/([m|l])ouse$/i' => '\1ice',
        '/(matr|vert|ind)(ix|ex)$/i'  => '\1ices',
        '/(x|ch|ss|sh)$/i' => '\1es',
        '/([^aeiouy]|qu)y$/i' => '\1ies',
        '/(hive)$/i' => '\1s',
        '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
        '/sis$/i' => 'ses',
        '/([ti])um$/i' => '\1a',
        '/(p)erson$/i' => '\1eople',
        '/(m)an$/i' => '\1en',
        '/(c)hild$/i' => '\1hildren',
        '/(buffal|tomat)o$/i' => '\1\2oes',
        '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i',
        '/us$/i' => 'uses',
        '/(alias)$/i' => '\1es',
        '/(ax|cris|test)is$/i' => '\1es',
        '/s$/' => 's',
        '/^$/' => '',
        '/$/' => 's',
    ),
    'uninflected' => array(
        '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', 'people'
    ),
    'irregular' => array(
        'atlas' => 'atlases',
        'beef' => 'beefs',
        'brother' => 'brothers',
        'cafe' => 'cafes',
        'child' => 'children',
        'corpus' => 'corpuses',
        'cow' => 'cows',
        'ganglion' => 'ganglions',
        'genie' => 'genies',
        'genus' => 'genera',
        'graffito' => 'graffiti',
        'hoof' => 'hoofs',
        'loaf' => 'loaves',
        'man' => 'men',
        'money' => 'monies',
        'mongoose' => 'mongooses',
        'move' => 'moves',
        'mythos' => 'mythoi',
        'niche' => 'niches',
        'numen' => 'numina',
        'occiput' => 'occiputs',
        'octopus' => 'octopuses',
        'opus' => 'opuses',
        'ox' => 'oxen',
        'penis' => 'penises',
        'person' => 'people',
        'sex' => 'sexes',
        'soliloquy' => 'soliloquies',
        'testis' => 'testes',
        'trilby' => 'trilbys',
        'turf' => 'turfs'
    )
)

$_pluralized ¶

public array

Cached array identity map of pluralized words.

array()

$_singular ¶

public array

Singular inflector rules

array(
    'rules' => array(
        '/(s)tatuses$/i' => '\1\2tatus',
        '/^(.*)(menu)s$/i' => '\1\2',
        '/(quiz)zes$/i' => '\\1',
        '/(matr)ices$/i' => '\1ix',
        '/(vert|ind)ices$/i' => '\1ex',
        '/^(ox)en/i' => '\1',
        '/(alias)(es)*$/i' => '\1',
        '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us',
        '/([ftw]ax)es/i' => '\1',
        '/(cris|ax|test)es$/i' => '\1is',
        '/(shoe|slave)s$/i' => '\1',
        '/(o)es$/i' => '\1',
        '/ouses$/' => 'ouse',
        '/([^a])uses$/' => '\1us',
        '/([m|l])ice$/i' => '\1ouse',
        '/(x|ch|ss|sh)es$/i' => '\1',
        '/(m)ovies$/i' => '\1\2ovie',
        '/(s)eries$/i' => '\1\2eries',
        '/([^aeiouy]|qu)ies$/i' => '\1y',
        '/([lr])ves$/i' => '\1f',
        '/(tive)s$/i' => '\1',
        '/(hive)s$/i' => '\1',
        '/(drive)s$/i' => '\1',
        '/([^fo])ves$/i' => '\1fe',
        '/(^analy)ses$/i' => '\1sis',
        '/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
        '/([ti])a$/i' => '\1um',
        '/(p)eople$/i' => '\1\2erson',
        '/(m)en$/i' => '\1an',
        '/(c)hildren$/i' => '\1\2hild',
        '/(n)ews$/i' => '\1\2ews',
        '/eaus$/' => 'eau',
        '/^(.*us)$/' => '\\1',
        '/s$/i' => ''
    ),
    'uninflected' => array(
        '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', '.*ss'
    ),
    'irregular' => array(
        'foes' => 'foe',
        'waves' => 'wave',
        'curves' => 'curve'
    )
)

$_singularized ¶

public array

Cached array identity map of singularized words.

array()

$_tableize ¶

public array

Tablize cached inflections

array()

$_transliteration ¶

public array

Default map of accented and special characters to ASCII characters

array(
    '/ä|æ|ǽ/' => 'ae',
    '/ö|œ/' => 'oe',
    '/ü/' => 'ue',
    '/Ä/' => 'Ae',
    '/Ü/' => 'Ue',
    '/Ö/' => 'Oe',
    '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A',
    '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a',
    '/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
    '/ç|ć|ĉ|ċ|č/' => 'c',
    '/Ð|Ď|Đ/' => 'D',
    '/ð|ď|đ/' => 'd',
    '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E',
    '/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e',
    '/Ĝ|Ğ|Ġ|Ģ/' => 'G',
    '/ĝ|ğ|ġ|ģ/' => 'g',
    '/Ĥ|Ħ/' => 'H',
    '/ĥ|ħ/' => 'h',
    '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I',
    '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i',
    '/Ĵ/' => 'J',
    '/ĵ/' => 'j',
    '/Ķ/' => 'K',
    '/ķ/' => 'k',
    '/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L',
    '/ĺ|ļ|ľ|ŀ|ł/' => 'l',
    '/Ñ|Ń|Ņ|Ň/' => 'N',
    '/ñ|ń|ņ|ň|ʼn/' => 'n',
    '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O',
    '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o',
    '/Ŕ|Ŗ|Ř/' => 'R',
    '/ŕ|ŗ|ř/' => 'r',
    '/Ś|Ŝ|Ş|Š/' => 'S',
    '/ś|ŝ|ş|š|ſ/' => 's',
    '/Ţ|Ť|Ŧ/' => 'T',
    '/ţ|ť|ŧ/' => 't',
    '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U',
    '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u',
    '/Ý|Ÿ|Ŷ/' => 'Y',
    '/ý|ÿ|ŷ/' => 'y',
    '/Ŵ/' => 'W',
    '/ŵ/' => 'w',
    '/Ź|Ż|Ž/' => 'Z',
    '/ź|ż|ž/' => 'z',
    '/Æ|Ǽ/' => 'AE',
    '/ß/'=> 'ss',
    '/IJ/' => 'IJ',
    '/ij/' => 'ij',
    '/Œ/' => 'OE',
    '/ƒ/' => 'f'
)

$_underscore ¶

public array

Cached Underscore Inflections

array()

$_uninflected ¶

public array

Words that should not be inflected

array(
    'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus',
    'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps',
    'debris', 'diabetes', 'djinn', 'eland', 'elk', 'equipment', 'Faroese', 'flounder',
    'Foochowese', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti',
    'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings',
    'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'mackerel', 'Maltese', '.*?media',
    'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese',
    'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese',
    'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors',
    'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'swine', 'testes',
    'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting', 'wildebeest',
    'Yengeese'
)
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs