当前位置: 首页>>代码示例>>PHP>>正文


PHP JModel::_createFileName方法代码示例

本文整理汇总了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;
 }
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:28,代码来源:jlgmodel.php

示例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);
 }
开发者ID:joebushi,项目名称:joomla,代码行数:27,代码来源:model.php

示例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);
 }
开发者ID:rikaryo,项目名称:joomla-cms,代码行数:33,代码来源:model.php


注:本文中的JModel::_createFileName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。