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


PHP JHtml::call方法代码示例

本文整理汇总了PHP中JHtml::call方法的典型用法代码示例。如果您正苦于以下问题:PHP JHtml::call方法的具体用法?PHP JHtml::call怎么用?PHP JHtml::call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JHtml的用法示例。


在下文中一共展示了JHtml::call方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _

 /**
  * Class loader method
  *
  * Additional arguments may be supplied and are passed to the sub-class.
  * Additional include paths are also able to be specified for third-party use
  *
  * @param	string	The name of helper method to load, (prefix).(class).function
  *					prefix and class are optional and can be used to load custom
  *					html helpers.
  */
 public static function _($type)
 {
     $type = preg_replace('#[^A-Z0-9_\\.]#i', '', $type);
     // Check to see if we need to load a helper file
     $parts = explode('.', $type);
     $prefix = count($parts) == 3 ? array_shift($parts) : 'JHtml';
     $file = count($parts) == 2 ? array_shift($parts) : '';
     $func = array_shift($parts);
     $key = strtolower($prefix . '.' . $file . '.' . $func);
     if (array_key_exists($key, self::$registry)) {
         $function = self::$registry[$key];
         $args = func_get_args();
         // remove function name from arguments
         array_shift($args);
         return JHtml::call($function, $args);
     }
     $className = $prefix . ucfirst($file);
     if (!class_exists($className)) {
         jimport('joomla.filesystem.path');
         if ($path = JPath::find(JHtml::$includePaths, strtolower($file) . '.php')) {
             require_once $path;
             if (!class_exists($className)) {
                 JError::raiseError(500, $className . '::' . $func . ' not found in file.');
                 return false;
             }
         } else {
             JError::raiseError(500, $prefix . $file . ' not supported. File not found.');
             return false;
         }
     }
     $toCall = array($className, $func);
     if (is_callable($toCall)) {
         JHtml::register($key, $toCall);
         $args = func_get_args();
         // remove function name from arguments
         array_shift($args);
         return JHtml::call($toCall, $args);
     } else {
         JError::raiseError(500, $className . '::' . $func . ' not supported.');
         return false;
     }
 }
开发者ID:joebushi,项目名称:joomla,代码行数:52,代码来源:html.php

示例2: _

 /**
  * Class loader method
  *
  * Additional arguments may be supplied and are passed to the sub-class.
  * Additional include paths are also able to be specified for third-party use
  *
  * @param   string  $key   The name of helper method to load, (prefix).(class).function
  *                         prefix and class are optional and can be used to load custom
  *                         html helpers.
  *
  * @return   mixed  JHtml::call($function, $args) or False on error
  * @since    11.1
  */
 public static function _($key)
 {
     list($key, $prefix, $file, $func) = self::extract($key);
     if (array_key_exists($key, self::$registry)) {
         $function = self::$registry[$key];
         $args = func_get_args();
         // Remove function name from arguments
         array_shift($args);
         return JHtml::call($function, $args);
     }
     $className = $prefix . ucfirst($file);
     if (!class_exists($className)) {
         jimport('joomla.filesystem.path');
         if ($path = JPath::find(JHtml::$includePaths, strtolower($file) . '.php')) {
             require_once $path;
             if (!class_exists($className)) {
                 JError::raiseError(500, JText::sprintf('JLIB_HTML_ERROR_NOTFOUNDINFILE', $className, $func));
                 return false;
             }
         } else {
             JError::raiseError(500, JText::sprintf('JLIB_HTML_ERROR_NOTSUPPORTED_NOFILE', $prefix, $file));
             return false;
         }
     }
     $toCall = array($className, $func);
     if (is_callable($toCall)) {
         JHtml::register($key, $toCall);
         $args = func_get_args();
         // Remove function name from arguments
         array_shift($args);
         return JHtml::call($toCall, $args);
     } else {
         JError::raiseError(500, JText::sprintf('JLIB_HTML_ERROR_NOTSUPPORTED', $className, $func));
         return false;
     }
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:49,代码来源:html.php


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