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


PHP CRM_Utils_File::isIncludable方法代码示例

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


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

示例1: loadEntity

 /**
  * Load/require all files related to an entity.
  *
  * This should not normally be called because it's does a file-system scan; it's
  * only appropriate when introspection is really required (eg for "getActions").
  *
  * @param string $entity
  *   API entity name.
  * @param int $version
  *   API version.
  */
 protected function loadEntity($entity, $version)
 {
     $camelName = _civicrm_api_get_camel_name($entity, $version);
     // Check for master entity file; to match _civicrm_api_resolve(), only load the first one
     $stdFile = 'api/v' . $version . '/' . $camelName . '.php';
     if (\CRM_Utils_File::isIncludable($stdFile)) {
         require_once $stdFile;
     }
     // Check for standalone action files; to match _civicrm_api_resolve(), only load the first one
     $loaded_files = array();
     // array($relativeFilePath => TRUE)
     $include_dirs = array_unique(explode(PATH_SEPARATOR, get_include_path()));
     foreach ($include_dirs as $include_dir) {
         foreach (array($camelName, 'Generic') as $name) {
             $action_dir = implode(DIRECTORY_SEPARATOR, array($include_dir, 'api', "v{$version}", $name));
             if (!is_dir($action_dir)) {
                 continue;
             }
             $iterator = new \DirectoryIterator($action_dir);
             foreach ($iterator as $fileinfo) {
                 $file = $fileinfo->getFilename();
                 if (array_key_exists($file, $loaded_files)) {
                     continue;
                     // action provided by an earlier item on include_path
                 }
                 $parts = explode(".", $file);
                 if (end($parts) == "php" && !preg_match('/Tests?\\.php$/', $file)) {
                     require_once $action_dir . DIRECTORY_SEPARATOR . $file;
                     $loaded_files[$file] = TRUE;
                 }
             }
         }
     }
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:45,代码来源:MagicFunctionProvider.php

示例2: tableQuery

 /**
  * Return a set of SQL queries whose cummulative weights will mark matched
  * records for the RuleGroup::threasholdQuery() to retrieve.
  */
 public function tableQuery()
 {
     // make sure we've got a fetched dbrecord, not sure if this is enforced
     if (!$this->name == NULL || $this->is_reserved == NULL) {
         $this->find(TRUE);
     }
     // Reserved Rule Groups can optionally get special treatment by
     // implementing an optimization class and returning a query array.
     if ($this->is_reserved && CRM_Utils_File::isIncludable("CRM/Dedupe/BAO/QueryBuilder/{$this->name}.php")) {
         include_once "CRM/Dedupe/BAO/QueryBuilder/{$this->name}.php";
         $class = "CRM_Dedupe_BAO_QueryBuilder_{$this->name}";
         $command = empty($this->params) ? 'internal' : 'record';
         $queries = call_user_func(array($class, $command), $this);
     } else {
         // All other rule groups have queries generated by the member dedupe
         // rules defined in the administrative interface.
         // Find all rules contained by this script sorted by weight so that
         // their execution can be short circuited on RuleGroup::fillTable()
         $bao = new CRM_Dedupe_BAO_Rule();
         $bao->dedupe_rule_group_id = $this->id;
         $bao->orderBy('rule_weight DESC');
         $bao->find();
         // Generate a SQL query for each rule in the rule group that is
         // tailored to respect the param and contactId options provided.
         $queries = array();
         while ($bao->fetch()) {
             $bao->contactIds = $this->contactIds;
             $bao->params = $this->params;
             // Skipping empty rules? Empty rules shouldn't exist; why check?
             if ($query = $bao->sql()) {
                 $queries["{$bao->rule_table}.{$bao->rule_field}.{$bao->rule_weight}"] = $query;
             }
         }
     }
     // if there are no rules in this rule group
     // add an empty query fulfilling the pattern
     if (!$queries) {
         $queries = array('SELECT 0 id1, 0 id2, 0 weight LIMIT 0');
         $this->noRules = TRUE;
     }
     return $queries;
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:46,代码来源:RuleGroup.php

示例3: getTemplateFileName

  /**
   * @return string
   */
  function getTemplateFileName() {
    $defaultTpl = parent::getTemplateFileName();

    if (in_array($this->_outputMode, array('print', 'pdf'))) {
      if ($this->_params['templates']) {
        $defaultTpl = 'CRM/Extendedreport/Form/Report/CustomTemplates/' . $this->_params['templates'] . '.tpl';
      }
    }

    if (!CRM_Utils_File::isIncludable('templates/' . $defaultTpl)) {
      $defaultTpl = 'CRM/Report/Form.tpl';
    }
    if (CRM_Utils_Array::value('templates', $this->_params) == 1) {
      //
    }
    return $defaultTpl;
  }
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:20,代码来源:ExtendedReport.php

示例4: _civicrm_api3_deprecation_check

/**
 * Check if the function is deprecated.
 *
 * @param string $entity
 * @param array $result
 *
 * @return string|array|null
 */
function _civicrm_api3_deprecation_check($entity, $result = array())
{
    if ($entity) {
        $apiFile = "api/v3/{$entity}.php";
        if (CRM_Utils_File::isIncludable($apiFile)) {
            require_once $apiFile;
        }
        $lowercase_entity = _civicrm_api_get_entity_name_from_camel($entity);
        $fnName = "_civicrm_api3_{$lowercase_entity}_deprecation";
        if (function_exists($fnName)) {
            return $fnName($result);
        }
    }
}
开发者ID:sugan2111,项目名称:Drupal_code,代码行数:22,代码来源:utils.php

示例5: loadClass

 /**
  * @param $class
  */
 public function loadClass($class)
 {
     if ((0 === strncmp($class, 'CRM_', 4) || 0 === strncmp($class, 'api_v3_', 7) || 0 === strncmp($class, 'WebTest_', 8) || 0 === strncmp($class, 'E2E_', 4)) && FALSE === strpos($class, '\\')) {
         $file = strtr($class, '_', '/') . '.php';
         // There is some question about the best way to do this.
         // "require_once" is nice because it's simple and throws
         // intelligible errors.
         if (FALSE != stream_resolve_include_path($file)) {
             require_once $file;
         }
     } elseif (in_array($class, $this->civiTestClasses)) {
         $file = "tests/phpunit/CiviTest/{$class}.php";
         if (FALSE != stream_resolve_include_path($file)) {
             require_once $file;
         }
     } elseif ($class === 'CiviSeleniumSettings') {
         if (!empty($GLOBALS['_CV'])) {
             require_once 'tests/phpunit/CiviTest/CiviSeleniumSettings.auto.php';
         } elseif (CRM_Utils_File::isIncludable('tests/phpunit/CiviTest/CiviSeleniumSettings.php')) {
             require_once 'tests/phpunit/CiviTest/CiviSeleniumSettings.php';
         }
     }
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:26,代码来源:ClassLoader.php

示例6: array

 /**
  * @param bool $force
  *
  * @return array
  * @throws Exception
  */
 public static function &getComponents($force = FALSE)
 {
     if (!isset(Civi::$statics[__CLASS__]['all']) || $force) {
         Civi::$statics[__CLASS__]['all'] = array();
         $cr = new CRM_Core_DAO_Component();
         $cr->find(FALSE);
         while ($cr->fetch()) {
             $infoClass = $cr->namespace . '_' . self::COMPONENT_INFO_CLASS;
             $infoClassFile = str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php';
             if (!CRM_Utils_File::isIncludable($infoClassFile)) {
                 continue;
             }
             require_once $infoClassFile;
             $infoObject = new $infoClass($cr->name, $cr->namespace, $cr->id);
             if ($infoObject->info['name'] !== $cr->name) {
                 CRM_Core_Error::fatal("There is a discrepancy between name in component registry and in info file ({$cr->name}).");
             }
             Civi::$statics[__CLASS__]['all'][$cr->name] = $infoObject;
             unset($infoObject);
         }
     }
     return Civi::$statics[__CLASS__]['all'];
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:29,代码来源:Component.php

示例7: _civicrm_api_loadEntity

/**
 * Load/require all files related to an entity.
 *
 * This should not normally be called because it's does a file-system scan; it's
 * only appropriate when introspection is really required (eg for "getActions").
 *
 * @param string $entity
 * @param int $version
 *
 * @return void
 */
function _civicrm_api_loadEntity($entity, $version = 3)
{
    /*
    $apiRequest = array();
    $apiRequest['entity'] = $entity;
    $apiRequest['action'] = 'pretty sure it will never exist. Trick to [try to] force resolve to scan everywhere';
    $apiRequest['version'] = $version;
    // look up function, file, is_generic
    $apiRequest = _civicrm_api_resolve($apiRequest);
    */
    $camelName = _civicrm_api_get_camel_name($entity, $version);
    // Check for master entity file; to match _civicrm_api_resolve(), only load the first one
    $stdFile = 'api/v' . $version . '/' . $camelName . '.php';
    if (CRM_Utils_File::isIncludable($stdFile)) {
        require_once $stdFile;
    }
    // Check for standalone action files; to match _civicrm_api_resolve(), only load the first one
    $loaded_files = array();
    // array($relativeFilePath => TRUE)
    $include_dirs = array_unique(explode(PATH_SEPARATOR, get_include_path()));
    foreach ($include_dirs as $include_dir) {
        $action_dir = implode(DIRECTORY_SEPARATOR, array($include_dir, 'api', "v{$version}", $camelName));
        if (!is_dir($action_dir)) {
            continue;
        }
        $iterator = new DirectoryIterator($action_dir);
        foreach ($iterator as $fileinfo) {
            $file = $fileinfo->getFilename();
            if (array_key_exists($file, $loaded_files)) {
                continue;
                // action provided by an earlier item on include_path
            }
            $parts = explode(".", $file);
            if (end($parts) == "php" && !preg_match('/Tests?\\.php$/', $file)) {
                require_once $action_dir . DIRECTORY_SEPARATOR . $file;
                $loaded_files[$file] = TRUE;
            }
        }
    }
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:51,代码来源:api.php


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