本文整理汇总了PHP中JModel::_createFileName方法的典型用法代码示例。如果您正苦于以下问题:PHP JModel::_createFileName方法的具体用法?PHP JModel::_createFileName怎么用?PHP JModel::_createFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModel
的用法示例。
在下文中一共展示了JModel::_createFileName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Overrides method to try to load model from extension if it exists
*/
public static function &getInstance($type, $prefix = '', $config = array())
{
$extensions = JoomleagueHelper::getExtensions(JRequest::getInt('p'));
foreach ($extensions as $e => $extension) {
$modelType = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
$modelClass = $prefix . ucfirst($modelType) . ucfirst($extension);
$result = false;
if (!class_exists($modelClass)) {
jimport('joomla.filesystem.path');
$path = JPath::find(JModel::addIncludePath(), JModel::_createFileName('model', array('name' => $modelType)));
if ($path) {
require_once $path;
if (class_exists($modelClass)) {
$result = new $modelClass($config);
return $result;
}
}
} else {
$result = new $modelClass($config);
return $result;
}
}
$instance = parent::getInstance($type, $prefix, $config);
return $instance;
}
示例2: getInstance
/**
* Returns a Model object, always creating it
*
* @param string The model type to instantiate
* @param string Prefix for the model class name. Optional.
* @param array Configuration array for model. Optional.
* @return mixed A model object, or false on failure
*/
public static function getInstance($type, $prefix = '', $config = array())
{
$type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
$modelClass = $prefix . ucfirst($type);
if (!class_exists($modelClass)) {
jimport('joomla.filesystem.path');
$path = JPath::find(JModel::addIncludePath(), JModel::_createFileName('model', array('name' => $type)));
if ($path) {
require_once $path;
if (!class_exists($modelClass)) {
JError::raiseWarning(0, 'Model class ' . $modelClass . ' not found in file.');
return false;
}
} else {
return false;
}
}
return new $modelClass($config);
}
示例3: getInstance
/**
* Returns a Model object, always creating it
*
* @param string $type The model type to instantiate
* @param string $prefix Prefix for the model class name. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return mixed A model object or false on failure
*
* @since 11.1
*/
public static function getInstance($type, $prefix = '', $config = array())
{
$type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
$modelClass = $prefix . ucfirst($type);
if (!class_exists($modelClass)) {
jimport('joomla.filesystem.path');
$path = JPath::find(JModel::addIncludePath(null, $prefix), JModel::_createFileName('model', array('name' => $type)));
if (!$path) {
$path = JPath::find(JModel::addIncludePath(null, ''), JModel::_createFileName('model', array('name' => $type)));
}
if ($path) {
require_once $path;
if (!class_exists($modelClass)) {
JError::raiseWarning(0, JText::sprintf('JLIB_APPLICATION_ERROR_MODELCLASS_NOT_FOUND', $modelClass));
return false;
}
} else {
return false;
}
}
return new $modelClass($config);
}