本文整理汇总了PHP中CModule::getModuleByName方法的典型用法代码示例。如果您正苦于以下问题:PHP CModule::getModuleByName方法的具体用法?PHP CModule::getModuleByName怎么用?PHP CModule::getModuleByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CModule
的用法示例。
在下文中一共展示了CModule::getModuleByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getModuleName
/**
* Utility function to return the current module name
* It first tries to get the name based on the table name,
* and infer the name from the class name. If neither of these
* are appropriate, children should implement this function themselves.
* or set _module_directory after construction.
*/
public function getModuleName()
{
/* If we've already done this, or our sub-class has set this,
we are on a winner */
if (!empty($this->_module_directory)) {
return $this->_module_directory;
}
/* Now the guessing game begins */
$mods = new CModule();
if (!empty($this->_permission_name)) {
if ($mod_name = $mods->getModuleByName($this->_permission_name)) {
$this->_module_directory = $mod_name;
return $mod_name;
}
}
$class = get_class($this);
// Class usually includes an initial C and is camel case
// And never is multibyte, so we are safe to use the non mb_ functions.
$class = strtolower(substr($class, 1));
if ($mod_name = $mods->getModuleByName($class)) {
$this->_module_directory = $mod_name;
return $mod_name;
}
return 'unknown';
}