/** * Gets the humanized name of the controller * * @param bool $plural * @return string */ public function getName($plural = false) { $name = YdCakeInflector::humanize(YdCakeInflector::underscore(str_replace('Controller', '', get_class($this->getOwner())))); return $plural ? YdCakeInflector::pluralize($name) : $name; //$name = preg_replace('/(?<![A-Z])[A-Z]/', ' \0', str_replace('Controller', '', get_class($this->getOwner()))); //$name = ucwords(trim(strtolower(str_replace(array('-', '_', '.'), ' ', $name)))); //return $name . ($plural ? 's' : ''); }
/** * Gets the humanized name of the controller * * @param bool $plural * @return string */ public function getName($plural = false) { Yii::import('dressing.components.YdCakeInflector'); $name = YdCakeInflector::humanize(YdCakeInflector::underscore(str_replace('Controller', '', get_class($this->getOwner())))); return $plural ? YdCakeInflector::pluralize($name) : $name; }