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