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


PHP CRM_Core_Resources::getPath方法代码示例

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


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

示例1: getResources

 /**
  * Get resources for one or more modules.
  *
  * @param string|array $moduleNames
  *   List of module names.
  * @param string $resType
  *   Type of resource ('js', 'css', 'settings').
  * @param string $refType
  *   Type of reference to the resource ('cacheUrl', 'rawUrl', 'path', 'settings').
  * @return array
  *   List of URLs or paths.
  * @throws \CRM_Core_Exception
  */
 public function getResources($moduleNames, $resType, $refType)
 {
     $result = array();
     $moduleNames = (array) $moduleNames;
     foreach ($moduleNames as $moduleName) {
         $module = $this->getModule($moduleName);
         if (isset($module[$resType])) {
             foreach ($module[$resType] as $file) {
                 switch ($refType) {
                     case 'path':
                         $result[] = $this->res->getPath($module['ext'], $file);
                         break;
                     case 'rawUrl':
                         $result[] = $this->res->getUrl($module['ext'], $file);
                         break;
                     case 'cacheUrl':
                         $result[] = $this->res->getUrl($module['ext'], $file, TRUE);
                         break;
                     case 'settings':
                         if (!empty($module[$resType])) {
                             $result[$moduleName] = $module[$resType];
                         }
                         break;
                     default:
                         throw new \CRM_Core_Exception("Unrecognized resource format");
                 }
             }
         }
     }
     return $result;
 }
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:44,代码来源:Manager.php

示例2: testGetModules

 /**
  * Modules appear to be well-defined.
  */
 public function testGetModules()
 {
     $modules = $this->angular->getModules();
     $counts = array('js' => 0, 'css' => 0, 'partials' => 0, 'settings' => 0);
     foreach ($modules as $module) {
         $this->assertTrue(is_array($module));
         $this->assertTrue(is_string($module['ext']));
         if (isset($module['js'])) {
             $this->assertTrue(is_array($module['js']));
             foreach ($module['js'] as $file) {
                 $this->assertTrue(file_exists($this->res->getPath($module['ext'], $file)));
                 $counts['js']++;
             }
         }
         if (isset($module['css'])) {
             $this->assertTrue(is_array($module['css']));
             foreach ($module['css'] as $file) {
                 $this->assertTrue(file_exists($this->res->getPath($module['ext'], $file)));
                 $counts['css']++;
             }
         }
         if (isset($module['partials'])) {
             $this->assertTrue(is_array($module['partials']));
             foreach ((array) $module['partials'] as $basedir) {
                 $this->assertTrue(is_dir($this->res->getPath($module['ext']) . '/' . $basedir));
                 $counts['partials']++;
             }
         }
         if (isset($module['settings'])) {
             $this->assertTrue(is_array($module['settings']));
             foreach ($module['settings'] as $name => $value) {
                 $counts['settings']++;
             }
         }
     }
     $this->assertTrue($counts['js'] > 0, 'Expect to find at least one JS file');
     $this->assertTrue($counts['css'] > 0, 'Expect to find at least one CSS file');
     $this->assertTrue($counts['partials'] > 0, 'Expect to find at least one partial HTML file');
     $this->assertTrue($counts['settings'] > 1, 'Expect to find at least one setting');
 }
开发者ID:routinet,项目名称:civicrm-core,代码行数:43,代码来源:ManagerTest.php


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