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


PHP eZModule::initialize方法代码示例

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


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

示例1: findModule

 /**
  * Loads a module object by name.
  * The only difference with exists() is that the $module parameter will be
  * assigned the found module.
  *
  * @param string $moduleName The name of the module to find (ex: content)
  * @param mixed $module This parameter will receive the found module object
  * @param array|string
  *        Either an array of path or a single path string. These will be
  *        used as additionnal locations that will be looked into
  * @param boolean $showError
  *        If true an error will be shown if the module it not found.
  * @return eZModule The eZModule object, or null if the module wasn't found
  * @see exists()
  */
 static function findModule($moduleName, $module = null, $pathList = null, $showError = false)
 {
     if ($pathList === null) {
         $pathList = array();
     } else {
         if (!is_array($pathList)) {
             $pathList = array($pathList);
         }
     }
     $searchPathList = eZModule::globalPathList();
     if ($searchPathList === null) {
         $searchPathList = array();
     }
     $searchPathList = array_merge($searchPathList, $pathList);
     $triedList = array();
     $triedDirList = array();
     $foundADir = false;
     foreach ($searchPathList as $path) {
         $dir = "{$path}/{$moduleName}";
         $file = "{$dir}/module.php";
         if (file_exists($file)) {
             if ($module === null) {
                 $module = new eZModule($path, $file, $moduleName, false);
             } else {
                 $module->initialize($path, $file, $moduleName, false);
             }
             return $module;
         } else {
             if (!file_exists($dir)) {
                 $triedDirList[] = $dir;
             } else {
                 $foundADir = true;
                 $triedList[] = $dir;
             }
         }
     }
     $msg = "Could not find module named '{$moduleName}'";
     if ($foundADir) {
         $msg = "\nThese directories had a directory named '{$moduleName}' but did not contain the module.php file:\n" . implode(", ", $triedList) . "\n" . "This usually means it is missing or has a wrong name.";
         if (count($triedDirList) > 0) {
             $msg .= "\n\nThese directories were tried too but none of them exists:\n" . implode(', ', $triedDirList);
         }
     } else {
         if (count($triedDirList) > 0) {
             $msg .= "\nThese directories were tried but none of them exists:\n" . implode(", ", $triedDirList);
         }
     }
     if ($showError) {
         eZDebug::writeWarning($msg);
     }
     return null;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:67,代码来源:ezmodule.php


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