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


PHP CRM_Utils_File::absoluteDirectory方法代码示例

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


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

示例1: retrieveDirectoryAndURLPreferences

 static function retrieveDirectoryAndURLPreferences(&$params, $setInConfig = false)
 {
     if ($setInConfig) {
         $config =& CRM_Core_Config::singleton();
     }
     $sql = "\nSELECT v.name as valueName, v.value, g.name as optionName\nFROM   civicrm_option_value v,\n       civicrm_option_group g\nWHERE  ( g.name = 'directory_preferences'\nOR       g.name = 'url_preferences' )\nAND    v.option_group_id = g.id\nAND    v.is_active = 1\n";
     require_once 'CRM/Utils/File.php';
     $dao = CRM_Core_DAO::executeQuery($sql);
     while ($dao->fetch()) {
         if (!$dao->value) {
             continue;
         }
         if ($dao->optionName == 'directory_preferences') {
             $value = CRM_Utils_File::absoluteDirectory($dao->value);
         } else {
             $value = CRM_Utils_System::absoluteURL($dao->value);
         }
         $params[$dao->valueName] = $value;
         if ($setInConfig) {
             $config->{$dao->valueName} = $value;
         }
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:23,代码来源:Preferences.php

示例2: retrieveDirectoryAndURLPreferences

 /**
  * @param array $params
  * @param bool $setInConfig
  */
 public static function retrieveDirectoryAndURLPreferences(&$params, $setInConfig = FALSE)
 {
     if (CRM_Core_Config::isUpgradeMode()) {
         $isJoomla = defined('CIVICRM_UF') && CIVICRM_UF == 'Joomla' ? TRUE : FALSE;
         // hack to set the resource base url so that js/ css etc is loaded correctly
         if ($isJoomla) {
             $params['userFrameworkResourceURL'] = CRM_Utils_File::addTrailingSlash(CIVICRM_UF_BASEURL, '/') . str_replace('administrator', '', CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', 'userFrameworkResourceURL', 'value', 'name'));
         }
         if (self::isUpgradeFromPreFourOneAlpha1()) {
             return;
         }
     }
     if ($setInConfig) {
         $config = CRM_Core_Config::singleton();
     }
     $sql = "\nSELECT name, group_name, value\nFROM   civicrm_setting\nWHERE  ( group_name = %1\nOR       group_name = %2 )\nAND domain_id = %3\n";
     $sqlParams = array(1 => array(self::DIRECTORY_PREFERENCES_NAME, 'String'), 2 => array(self::URL_PREFERENCES_NAME, 'String'), 3 => array(CRM_Core_Config::domainID(), 'Integer'));
     $dao = CRM_Core_DAO::executeQuery($sql, $sqlParams, TRUE, NULL, FALSE, TRUE, TRUE);
     if (is_a($dao, 'DB_Error')) {
         echo "Fatal DB error, exiting, seems like your schema does not have civicrm_setting table\n";
         exit;
     }
     while ($dao->fetch()) {
         $value = self::getOverride($dao->group_name, $dao->name, NULL);
         if ($value === NULL && $dao->value) {
             $value = unserialize($dao->value);
             if ($dao->group_name == self::DIRECTORY_PREFERENCES_NAME) {
                 $value = CRM_Utils_File::absoluteDirectory($value);
             } else {
                 // CRM-7622: we need to remove the language part
                 $value = CRM_Utils_System::absoluteURL($value, TRUE);
             }
         }
         // CRM-10931, If DB doesn't have any value, carry on with any default value thats already available
         if (!isset($value) && !empty($params[$dao->name])) {
             $value = $params[$dao->name];
         }
         $params[$dao->name] = $value;
         if ($setInConfig) {
             $config->{$dao->name} = $value;
         }
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:47,代码来源:Setting.php

示例3: getPath

 /**
  * Determine the absolute path to a file, given that the file is most likely
  * in a given particular variable.
  *
  * @param string $value
  *   The file path.
  *   Use "." to reference to default file root.
  *   Values may begin with a variable, e.g. "[civicrm.files]/upload".
  * @return mixed|string
  */
 public function getPath($value)
 {
     $defaultContainer = self::DEFAULT_PATH;
     if ($value && $value[0] == '[' && preg_match(';^\\[([a-zA-Z0-9\\._]+)\\]/(.*);', $value, $matches)) {
         $defaultContainer = $matches[1];
         $value = $matches[2];
     }
     if (empty($value)) {
         return FALSE;
     }
     if ($value === '.') {
         $value = '';
     }
     return \CRM_Utils_File::absoluteDirectory($value, $this->getVariable($defaultContainer, 'path'));
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:25,代码来源:Paths.php


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