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


PHP JFormHelper::addPath方法代码示例

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


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

示例1: loadClass

 /**
  * Load a class for one of the form's entities of a particular type.
  * Currently, it makes sense to use this method for the "field" and "rule" entities
  * (but you can support more entities in your subclass).
  *
  * @param   string  $entity  One of the form entities (field or rule).
  * @param   string  $type    Type of an entity.
  *
  * @return  mixed  Class name on success or false otherwise.
  *
  * @since   11.1
  */
 protected static function loadClass($entity, $type)
 {
     $class = 'JForm' . ucfirst($entity) . ucfirst($type);
     if (class_exists($class)) {
         return $class;
     }
     // Get the field search path array.
     $paths = JFormHelper::addPath($entity);
     // If the type is complex, add the base type to the paths.
     if ($pos = strpos($type, '_')) {
         // Add the complex type prefix to the paths.
         for ($i = 0, $n = count($paths); $i < $n; $i++) {
             // Derive the new path.
             $path = $paths[$i] . '/' . strtolower(substr($type, 0, $pos));
             // If the path does not exist, add it.
             if (!in_array($path, $paths)) {
                 array_unshift($paths, $path);
             }
         }
         // Break off the end of the complex type.
         $type = substr($type, $pos + 1);
     }
     // Try to find the class file.
     if ($file = JPath::find($paths, strtolower($type) . '.php')) {
         include_once $file;
     }
     // Check for all if the class exists.
     return class_exists($class) ? $class : false;
 }
开发者ID:hitkoko,项目名称:joomla-platform,代码行数:41,代码来源:helper.php

示例2: loadClass

 /**
  * Load a class for one of the form's entities of a particular type.
  * Currently, it makes sense to use this method for the "field" and "rule" entities
  * (but you can support more entities in your subclass).
  *
  * @param   string  $entity  One of the form entities (field or rule).
  * @param   string  $type    Type of an entity.
  *
  * @return  mixed  Class name on success or false otherwise.
  *
  * @since   11.1
  */
 protected static function loadClass($entity, $type)
 {
     if (strpos($type, '.')) {
         list($prefix, $type) = explode('.', $type);
     } else {
         $prefix = 'J';
     }
     $class = JString::ucfirst($prefix, '_') . 'Form' . JString::ucfirst($entity, '_') . JString::ucfirst($type, '_');
     if (class_exists($class)) {
         return $class;
     }
     // Get the field search path array.
     $paths = JFormHelper::addPath($entity);
     // If the type is complex, add the base type to the paths.
     if ($pos = strpos($type, '_')) {
         // Add the complex type prefix to the paths.
         for ($i = 0, $n = count($paths); $i < $n; $i++) {
             // Derive the new path.
             $path = $paths[$i] . '/' . strtolower(substr($type, 0, $pos));
             // If the path does not exist, add it.
             if (!in_array($path, $paths)) {
                 $paths[] = $path;
             }
         }
         // Break off the end of the complex type.
         $type = substr($type, $pos + 1);
     }
     // Try to find the class file.
     $type = strtolower($type) . '.php';
     foreach ($paths as $path) {
         if ($file = JPath::find($path, $type)) {
             require_once $file;
             if (class_exists($class)) {
                 break;
             }
         }
     }
     // Check for all if the class exists.
     return class_exists($class) ? $class : false;
 }
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:52,代码来源:helper.php


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