inflector.php File Reference

Go to the source code of this file.

Namespaces

namespace  cake

Functions

 __enclose ($string)
 __initPluralRules ()
 __initSingularRules ()
 camelize ($lowerCaseAndUnderscoredWord)
 classify ($tableName)
getInstance ()
 humanize ($lowerCaseAndUnderscoredWord)
 pluralize ($word)
 singularize ($word)
 slug ($string, $replacement= '_')
 tableize ($className)
 underscore ($camelCasedWord)
 variable ($string)

Variables

 $__irregularPlural = array()
 $__irregularSingular = array()
 $__pluralRules = array()
 $__singularRules = array()
 $__uninflectedPlural = array()
 $__uninflectedSingular = array()
 $pluralRules = array()
 $singularized = array()
 $singularRules = array()


Function Documentation

__enclose ( string  ) 

Enclose a string for preg matching.

Parameters:
string $string String to enclose
Returns:
string Enclosed string

Definition at line 525 of file inflector.php.

Referenced by pluralize(), and singularize().

__initPluralRules (  ) 

Initializes plural inflection rules.

Returns:
void private

Definition at line 150 of file inflector.php.

References $pluralRules, a(), Set::pushDiff(), and uses().

__initSingularRules (  ) 

Initializes singular inflection rules.

Returns:
void protected

Definition at line 275 of file inflector.php.

References $singularRules, a(), Set::pushDiff(), and uses().

camelize ( lowerCaseAndUnderscoredWord  )  [static]

Returns the given lower_case_and_underscored_word as a CamelCased word.

Parameters:
string $lower_case_and_underscored_word Word to camelize
Returns:
string Camelized word. LikeThis. public
http://book.cakephp.org/view/572/Class-methods

Definition at line 416 of file inflector.php.

Referenced by JsHelperObject::__call(), CakeSchema::__construct(), AclComponent::__construct(), Model::__generateAssociation(), ConnectionManager::__getDriver(), TestTask::__interactive(), Dispatcher::__loadController(), App::__map(), App::__mapped(), Controller::__mergeVars(), AjaxHelper::__optionsForAjax(), App::__remove(), FormHelper::__selectOptions(), App::__settings(), Shell::_controllerName(), Dispatcher::_invoke(), Shell::_modelName(), Shell::_modelNameFromKey(), AuthComponent::action(), AjaxHelper::autoComplete(), ControllerTask::bake(), classify(), FormHelper::create(), Dispatcher::dispatch(), ShellDispatcher::dispatch(), Helper::domId(), ViewTask::execute(), PluginTask::execute(), ModelTask::execute(), ControllerTask::execute(), ControllerTask::getName(), App::import(), ConsoleShell::initialize(), Configure::listObjects(), Shell::loadTasks(), ApiShell::main(), ErrorHandler::missingComponentClass(), ErrorHandler::missingComponentFile(), ErrorHandler::missingHelperClass(), ErrorHandler::missingHelperFile(), FormHelper::radio(), Controller::render(), XmlNode::toArray(), and variable().

classify ( tableName  )  [static]

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 public
http://book.cakephp.org/view/572/Class-methods

Definition at line 465 of file inflector.php.

References camelize(), and singularize().

Referenced by Controller::__construct(), Object::__openPersistent(), TestTask::bake(), PluginTask::execute(), BakeShell::loadTasks(), and CakeSchema::read().

& getInstance (  ) 

Gets a reference to the Inflector object instance

Returns:
object public

Definition at line 127 of file inflector.php.

References $irregularPlural, $pluralRules, $singularRules, and $uninflectedPlural.

Referenced by pluralize(), and singularize().

humanize ( lowerCaseAndUnderscoredWord  )  [static]

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

Parameters:
string $lower_case_and_underscored_word String to be made more readable
Returns:
string Human-readable string public
http://book.cakephp.org/view/572/Class-methods

Definition at line 441 of file inflector.php.

Referenced by ViewTask::__loadController(), Scaffold::__scaffoldDelete(), Scaffold::__scaffoldSave(), Scaffold::__scaffoldView(), Shell::_pluralHumanName(), Shell::_singularHumanName(), ControllerTask::bakeActions(), PagesController::display(), FormHelper::error(), FormHelper::inputs(), FormHelper::label(), FormHelper::radio(), View::renderLayout(), and PaginatorHelper::sort().

pluralize ( word  )  [static]

Return $word in plural form.

Parameters:
string $word Word in singular
Returns:
string Word in plural public
http://book.cakephp.org/view/572/Class-methods

Definition at line 234 of file inflector.php.

References $pluralRules, __enclose(), and getInstance().

Referenced by ViewTask::__associations(), DboSource::__mergeAssociation(), Scaffold::__scaffoldSave(), AuthComponent::__setDefaults(), Model::_clearCache(), Shell::_controllerName(), Shell::_pluralHumanName(), Shell::_pluralName(), FormHelper::create(), PluginTask::execute(), FormHelper::input(), BakeShell::loadTasks(), AclNode::node(), and tableize().

singularize ( word  )  [static]

Return $word in singular form.

Parameters:
string $word Word in plural
Returns:
string Word in singular public
http://book.cakephp.org/view/572/Class-methods

Definition at line 370 of file inflector.php.

References $singularRules, __enclose(), and getInstance().

Referenced by Model::__generateAssociation(), ViewTask::__loadController(), Shell::_modelKey(), Shell::_modelName(), Shell::_singularHumanName(), Shell::_singularName(), and classify().

slug ( string,
replacement = '_' 
) [static]

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

Parameters:
string $string
string $replacement
Returns:
string public
http://book.cakephp.org/view/572/Class-methods

Definition at line 493 of file inflector.php.

References String::insert().

Referenced by CakeSchema::__construct(), CacheHelper::__writeFile(), CacheHelper::cache(), Dispatcher::cached(), View::element(), XcacheEngine::init(), MemcacheEngine::init(), ApcEngine::init(), and XmlNode::normalize().

tableize ( className  )  [static]

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 public
http://book.cakephp.org/view/572/Class-methods

Definition at line 453 of file inflector.php.

References pluralize(), and underscore().

Referenced by Model::__construct(), ModelTask::__interactive(), TestTask::bake(), ModelTask::bake(), ModelTask::doAssociations(), and ModelTask::fixture().

underscore ( camelCasedWord  )  [static]

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 public
http://book.cakephp.org/view/572/Class-methods

Definition at line 428 of file inflector.php.

Referenced by ViewTask::__associations(), I18n::__bindTextDomain(), ShellDispatcher::__buildPaths(), TestSuiteShell::__canRun(), Router::__connectDefaultRoutes(), Controller::__construct(), TestSuiteShell::__findFolderByCategory(), Model::__generateAssociation(), ViewTask::__interactive(), DbConfigTask::__interactive(), ControllerTask::__interactive(), Scaffold::__scaffoldDelete(), Scaffold::__scaffoldView(), FormHelper::__selectOptions(), AuthComponent::__setDefaults(), App::__settings(), CakeSchema::_build(), Model::_clearCache(), Shell::_controllerPath(), View::_getLayoutFileName(), ScaffoldView::_getViewFileName(), View::_getViewFileName(), Component::_loadComponents(), View::_loadHelpers(), Shell::_modelKey(), Shell::_pluralHumanName(), Shell::_singularHumanName(), ClassRegistry::addObject(), ViewTask::bake(), TestTask::bake(), PluginTask::bake(), ModelTask::bake(), ModelTask::bakeTest(), ControllerTask::bakeTest(), CacheHelper::cache(), FormHelper::create(), SchemaShell::dump(), ViewTask::execute(), TestTask::execute(), PluginTask::execute(), ModelTask::fixture(), ClassRegistry::getObject(), App::import(), TestSuiteShell::initialize(), FormHelper::inputs(), ClassRegistry::isKeySet(), CacheEngine::key(), FormHelper::label(), Shell::loadTasks(), BakeShell::loadTasks(), TestSuiteShell::main(), ApiShell::main(), ClassRegistry::map(), Router::mapResources(), AclNode::node(), XmlNode::normalize(), DboSource::query(), FormHelper::radio(), ClassRegistry::removeObject(), Controller::render(), SchemaShell::startup(), tableize(), Model::updateCounterCache(), and variable().

variable ( string  )  [static]

Returns camelBacked version of an underscored string.

Parameters:
string $string
Returns:
string in variable form public
http://book.cakephp.org/view/572/Class-methods

Definition at line 477 of file inflector.php.

References camelize(), and underscore().

Referenced by ViewTask::__loadController(), Scaffold::__scaffoldIndex(), Scaffold::__scaffoldSave(), Scaffold::__scaffoldView(), CacheHelper::__writeFile(), Shell::_pluralName(), View::_render(), Shell::_singularName(), ControllerTask::bakeActions(), ShellDispatcher::dispatch(), FormHelper::input(), and Controller::set().


Variable Documentation

$__irregularPlural = array()

Definition at line 99 of file inflector.php.

$__irregularSingular = array()

Definition at line 120 of file inflector.php.

$__pluralRules = array()

Definition at line 85 of file inflector.php.

$__singularRules = array()

Definition at line 106 of file inflector.php.

$__uninflectedPlural = array()

Definition at line 92 of file inflector.php.

$__uninflectedSingular = array()

Definition at line 113 of file inflector.php.

$pluralRules = array()

Definition at line 63 of file inflector.php.

$singularized = array()

Definition at line 70 of file inflector.php.

$singularRules = array()

Definition at line 78 of file inflector.php.


Generated on Sun Nov 22 00:30:54 2009 for CakePHP 1.2.x.x (v1.2.4.8284) by doxygen 1.4.7