當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。