本文整理汇总了PHP中AkInflector::is_plural方法的典型用法代码示例。如果您正苦于以下问题:PHP AkInflector::is_plural方法的具体用法?PHP AkInflector::is_plural怎么用?PHP AkInflector::is_plural使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AkInflector
的用法示例。
在下文中一共展示了AkInflector::is_plural方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cast
function cast()
{
$this->model_name = AkInflector::camelize($this->model_name);
$this->model_file_path = AkInflector::toModelFilename($this->model_name);
if (empty($this->actions) && !empty($this->controller_name) && strstr($this->controller_name, ',')) {
$this->controller_name = '';
}
$this->controller_name = empty($this->controller_name) ? AkInflector::pluralize($this->model_name) : AkInflector::camelize($this->controller_name);
$this->controller_file_path = AkInflector::toControllerFilename($this->controller_name);
$this->controller_class_name = str_replace(array('/', '::'), '_', $this->controller_name . 'Controller');
$this->controller_name = AkInflector::demodulize($this->controller_name);
$this->controller_human_name = AkInflector::humanize($this->controller_name);
$this->helper_name = (AkInflector::is_plural($this->controller_name) ? AkInflector::singularize($this->controller_name) : $this->controller_name) . 'Helper';
$this->helper_var_name = '$' . AkInflector::underscore($this->helper_name);
$this->singular_name = AkInflector::underscore($this->model_name);
$this->plural_name = AkInflector::pluralize($this->singular_name);
$this->singular_controller_name = AkInflector::underscore($this->controller_name);
$this->module_preffix = AkInflector::underscore(substr($this->controller_class_name, 0, strrpos($this->controller_class_name, '_')));
$this->module_preffix = empty($this->module_preffix) ? '' : DS . $this->module_preffix;
$this->files = array('controller.php' => $this->controller_file_path, 'helper.php' => AK_HELPERS_DIR . $this->module_preffix . DS . trim($this->helper_var_name, '$') . '.php', 'layout' => AK_VIEWS_DIR . DS . 'layouts' . DS . $this->singular_controller_name . '.tpl', 'view_add' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . 'add.tpl', 'view_destroy' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . 'destroy.tpl', 'view_edit' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . 'edit.tpl', 'view_listing' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . 'listing.tpl', 'view_show' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . 'show.tpl', 'form' => AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . '_form.tpl');
$this->user_actions = array();
foreach ((array) @$this->actions as $action) {
$this->user_actions[$action] = AK_VIEWS_DIR . $this->module_preffix . DS . $this->singular_controller_name . DS . $action . '.tpl';
}
}
示例2: hasCollisions
function hasCollisions()
{
$this->_preloadPaths();
$this->collisions = array();
if (AkInflector::is_plural($this->class_name)) {
$this->collisions[] = Ak::t('%class_name should be a singular noun', array('%class_name' => $this->class_name));
}
$files = array(AkInflector::toModelFilename($this->class_name), AK_TEST_DIR . DS . 'unit' . DS . 'app' . DS . 'models' . DS . $this->underscored_model_name . '.php', AK_TEST_DIR . DS . 'fixtures' . DS . $this->model_path, AK_TEST_DIR . DS . 'fixtures' . DS . $this->installer_path);
foreach ($files as $file_name) {
if (file_exists($file_name)) {
$this->collisions[] = Ak::t('%file_name file already exists', array('%file_name' => $file_name));
}
}
return count($this->collisions) > 0;
}
示例3: hasCollisions
public function hasCollisions()
{
$this->_preloadPaths();
$this->collisions = array();
if (AkInflector::is_plural($this->class_name)) {
$this->collisions[] = Ak::t('%class_name should be a singular noun', array('%class_name' => $this->class_name));
}
$files = array(AkInflector::toModelFilename($this->class_name), AkConfig::getDir('test') . DS . 'unit' . DS . $this->test_file_name);
if (!$this->active_document) {
$files[] = AkConfig::getDir('app_installers') . DS . $this->underscored_model_name . '_installer.php';
}
foreach ($files as $file_name) {
if (file_exists($file_name)) {
$this->collisions[] = Ak::t('%file_name file already exists', array('%file_name' => $file_name));
}
}
return count($this->collisions) > 0;
}
示例4: getCurrentControllerHelper
function getCurrentControllerHelper()
{
$helper = $this->getControllerName();
$helper = AkInflector::is_plural($helper) ? AkInflector::singularize($helper) : $helper;
$helper_file_name = AK_HELPERS_DIR . DS . $this->_module_path . AkInflector::underscore($helper) . '_helper.php';
if (file_exists($helper_file_name)) {
return array($helper_file_name => $helper);
}
return array();
}
示例5: test_should_detect_plurals
function test_should_detect_plurals()
{
foreach (array_values($this->SingularToPlural) as $plural) {
$this->assertTrue(AkInflector::is_plural($plural), $plural . ' is not detected as plural');
}
}
示例6: getCurrentControllerHelper
public function getCurrentControllerHelper()
{
$helper = $this->getControllerName();
$helper = AkInflector::is_plural($helper) ? AkInflector::singularize($helper) : $helper;
$helper_file_name = AkConfig::getDir('helpers') . DS . $this->getModulePath() . AkInflector::underscore($helper) . '_helper.php';
if (file_exists($helper_file_name)) {
return array($helper_file_name => $helper);
}
return array();
}