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


PHP CRM_Utils_File::baseFilePath方法代码示例

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


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

示例1: getDefaultFileStorage

 /**
  * Moved from CRM_Utils_System_Base
  */
 public function getDefaultFileStorage()
 {
     $config = CRM_Core_Config::singleton();
     $cmsUrl = CRM_Utils_System::languageNegotiationURL($config->userFrameworkBaseURL, FALSE, TRUE);
     $cmsPath = $this->cmsRootPath();
     $filesPath = CRM_Utils_File::baseFilePath();
     $filesRelPath = CRM_Utils_File::relativize($filesPath, $cmsPath);
     $filesURL = rtrim($cmsUrl, '/') . '/' . ltrim($filesRelPath, ' /');
     return array('url' => CRM_Utils_File::addTrailingSlash($filesURL, '/'), 'path' => CRM_Utils_File::addTrailingSlash($filesPath));
 }
开发者ID:sarehag,项目名称:civicrm-core,代码行数:13,代码来源:WordPress.php

示例2: setValues

 /**
  * Set the default values.
  * in an empty db, also called when setting component using GUI
  *
  * @param array $defaults
  *   Associated array of form elements.
  * @param bool $formMode
  *   this variable is set true for GUI
  *   mode (eg: Global setting >> Components)
  *
  */
 public static function setValues(&$defaults, $formMode = FALSE)
 {
     $config = CRM_Core_Config::singleton();
     $baseURL = $config->userFrameworkBaseURL;
     // CRM-6216: Drupal’s $baseURL might have a trailing LANGUAGE_NEGOTIATION_PATH,
     // which needs to be stripped before we start basing ResourceURL on it
     if ($config->userSystem->is_drupal) {
         global $language;
         if (isset($language->prefix) and $language->prefix) {
             if (substr($baseURL, -(strlen($language->prefix) + 1)) == $language->prefix . '/') {
                 $baseURL = substr($baseURL, 0, -(strlen($language->prefix) + 1));
             }
         }
     }
     $baseCMSURL = CRM_Utils_System::baseCMSURL();
     if ($config->templateCompileDir) {
         $path = CRM_Utils_File::baseFilePath($config->templateCompileDir);
     }
     if (!isset($defaults['enableSSL'])) {
         $defaults['enableSSL'] = 0;
     }
     //set defaults if not set in db
     if (!isset($defaults['userFrameworkResourceURL'])) {
         if ($config->userFramework == 'Joomla') {
             $defaults['userFrameworkResourceURL'] = $baseURL . "components/com_civicrm/civicrm/";
         } elseif ($config->userFramework == 'WordPress') {
             $defaults['userFrameworkResourceURL'] = $baseURL . "wp-content/plugins/civicrm/civicrm/";
         } else {
             // Drupal setting
             // check and see if we are installed in sites/all (for D5 and above)
             // we dont use checkURL since drupal generates an error page and throws
             // the system for a loop on lobo's macosx box
             // or in modules
             global $civicrm_root;
             $cmsPath = $config->userSystem->cmsRootPath();
             $defaults['userFrameworkResourceURL'] = $baseURL . str_replace("{$cmsPath}/", '', str_replace('\\', '/', $civicrm_root));
             if (strpos($civicrm_root, DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . 'all' . DIRECTORY_SEPARATOR . 'modules') === FALSE) {
                 $startPos = strpos($civicrm_root, DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR);
                 $endPos = strpos($civicrm_root, DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR);
                 if ($startPos && $endPos) {
                     // if component is in sites/SITENAME/modules
                     $siteName = substr($civicrm_root, $startPos + 7, $endPos - $startPos - 7);
                     $civicrmDirName = trim(basename($civicrm_root));
                     $defaults['userFrameworkResourceURL'] = $baseURL . "sites/{$siteName}/modules/{$civicrmDirName}/";
                     if (!isset($defaults['imageUploadURL'])) {
                         $defaults['imageUploadURL'] = $baseURL . "sites/{$siteName}/files/civicrm/persist/contribute/";
                     }
                 }
             }
         }
     }
     if (!isset($defaults['imageUploadURL'])) {
         if ($config->userFramework == 'Joomla') {
             // gross hack
             // we need to remove the administrator/ from the end
             $tempURL = str_replace("/administrator/", "/", $baseURL);
             $defaults['imageUploadURL'] = $tempURL . "media/civicrm/persist/contribute/";
         } elseif ($config->userFramework == 'WordPress') {
             //for standalone no need of sites/defaults directory
             $defaults['imageUploadURL'] = $baseURL . "wp-content/plugins/files/civicrm/persist/contribute/";
         } else {
             $defaults['imageUploadURL'] = $baseURL . "sites/default/files/civicrm/persist/contribute/";
         }
     }
     if (!isset($defaults['imageUploadDir']) && is_dir($config->templateCompileDir)) {
         $imgDir = $path . "persist/contribute/";
         CRM_Utils_File::createDir($imgDir);
         $defaults['imageUploadDir'] = $imgDir;
     }
     if (!isset($defaults['uploadDir']) && is_dir($config->templateCompileDir)) {
         $uploadDir = $path . "upload/";
         CRM_Utils_File::createDir($uploadDir);
         CRM_Utils_File::restrictAccess($uploadDir);
         $defaults['uploadDir'] = $uploadDir;
     }
     if (!isset($defaults['customFileUploadDir']) && is_dir($config->templateCompileDir)) {
         $customDir = $path . "custom/";
         CRM_Utils_File::createDir($customDir);
         CRM_Utils_File::restrictAccess($customDir);
         $defaults['customFileUploadDir'] = $customDir;
     }
     // FIXME: hack to bypass the step for generating defaults for components,
     // while running upgrade, to avoid any serious non-recoverable error
     // which might hinder the upgrade process.
     $args = array();
     if (isset($_GET[$config->userFrameworkURLVar])) {
         $args = explode('/', $_GET[$config->userFrameworkURLVar]);
     }
     if (isset($defaults['enableComponents'])) {
//.........这里部分代码省略.........
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:101,代码来源:Defaults.php

示例3: getDefaultFileStorage

 /**
  * Moved from CRM_Utils_System_Base
  */
 public function getDefaultFileStorage()
 {
     global $civicrm_root;
     $config = CRM_Core_Config::singleton();
     $baseURL = CRM_Utils_System::languageNegotiationURL($config->userFrameworkBaseURL, FALSE, TRUE);
     $filesURL = NULL;
     $filesPath = NULL;
     $upload_dir = wp_upload_dir();
     $settingsDir = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR;
     $settingsURL = $upload_dir['baseurl'] . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR;
     if (is_dir(WP_PLUGIN_DIR . '/files/civicrm/')) {
         //for legacy path
         $filesURL = WP_PLUGIN_URL . "/files/civicrm/";
     } elseif (is_dir($settingsDir)) {
         $filesURL = $settingsURL;
     } else {
         throw new CRM_Core_Exception("Failed to locate default file storage ({$config->userFramework})");
     }
     return array('url' => $filesURL, 'path' => CRM_Utils_File::baseFilePath());
 }
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:23,代码来源:WordPress.php

示例4: getDefaultFileStorage

 /**
  * Determine the default location for file storage.
  *
  * FIXME:
  *  1. This was pulled out from a bigger function. It should be split
  *     into even smaller pieces and marked abstract.
  *  2. This would be easier to compute by a calling a CMS API, but
  *     for whatever reason Civi gets it from config data.
  *
  * @return array
  *   - url: string. ex: "http://example.com/sites/foo.com/files/civicrm"
  *   - path: string. ex: "/var/www/sites/foo.com/files/civicrm"
  */
 public function getDefaultFileStorage()
 {
     global $civicrm_root;
     $config = CRM_Core_Config::singleton();
     $baseURL = CRM_Utils_System::languageNegotiationURL($config->userFrameworkBaseURL, FALSE, TRUE);
     $filesURL = NULL;
     $filesPath = NULL;
     if ($config->userFramework == 'Joomla') {
         // gross hack
         // we need to remove the administrator/ from the end
         $tempURL = str_replace("/administrator/", "/", $baseURL);
         $filesURL = $tempURL . "media/civicrm/";
     } elseif ($this->is_drupal) {
         $siteName = $config->userSystem->parseDrupalSiteName($civicrm_root);
         if ($siteName) {
             $filesURL = $baseURL . "sites/{$siteName}/files/civicrm/";
         } else {
             $filesURL = $baseURL . "sites/default/files/civicrm/";
         }
     } elseif ($config->userFramework == 'UnitTests') {
         $filesURL = $baseURL . "sites/default/files/civicrm/";
     } else {
         throw new CRM_Core_Exception("Failed to locate default file storage ({$config->userFramework})");
     }
     return array('url' => $filesURL, 'path' => CRM_Utils_File::baseFilePath());
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:39,代码来源:Base.php

示例5: _initialize

 /**
  * Initializes the entire application.
  * Reads constants defined in civicrm.settings.php and
  * stores them in config properties.
  *
  * @param bool $loadFromDB
  */
 private function _initialize($loadFromDB = TRUE)
 {
     // following variables should be set in CiviCRM settings and
     // as crucial ones, are defined upon initialisation
     // instead of in CRM_Core_Config_Defaults
     if (defined('CIVICRM_DSN')) {
         $this->dsn = CIVICRM_DSN;
     } elseif ($loadFromDB) {
         // bypass when calling from gencode
         echo 'You need to define CIVICRM_DSN in civicrm.settings.php';
         exit;
     }
     if (defined('CIVICRM_TEMPLATE_COMPILEDIR')) {
         $this->templateCompileDir = CRM_Utils_File::addTrailingSlash(CIVICRM_TEMPLATE_COMPILEDIR);
         // also make sure we create the config directory within this directory
         // the below statement will create both the templates directory and the config and log directory
         $this->configAndLogDir = CRM_Utils_File::baseFilePath($this->templateCompileDir) . 'ConfigAndLog' . DIRECTORY_SEPARATOR;
         CRM_Utils_File::createDir($this->configAndLogDir);
         CRM_Utils_File::restrictAccess($this->configAndLogDir);
         // we're automatically prefixing compiled templates directories with country/language code
         global $tsLocale;
         if (!empty($tsLocale)) {
             $this->templateCompileDir .= CRM_Utils_File::addTrailingSlash($tsLocale);
         } elseif (!empty($this->lcMessages)) {
             $this->templateCompileDir .= CRM_Utils_File::addTrailingSlash($this->lcMessages);
         }
         CRM_Utils_File::createDir($this->templateCompileDir);
         CRM_Utils_File::restrictAccess($this->templateCompileDir);
     } elseif ($loadFromDB) {
         echo 'You need to define CIVICRM_TEMPLATE_COMPILEDIR in civicrm.settings.php';
         exit;
     }
     $this->_initDAO();
     if (defined('CIVICRM_UF')) {
         $this->userFramework = CIVICRM_UF;
         $this->_setUserFrameworkConfig($this->userFramework);
     } else {
         echo 'You need to define CIVICRM_UF in civicrm.settings.php';
         exit;
     }
     // also initialize the logger
     self::$_log = Log::singleton('display');
     // initialize component registry early to avoid "race"
     // between CRM_Core_Config and CRM_Core_Component (they
     // are co-dependant)
     $this->componentRegistry = new CRM_Core_Component();
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:54,代码来源:Config.php

示例6: initialize

 /**
  * @param bool $loadFromDB
  */
 public function initialize($loadFromDB = TRUE)
 {
     if (!defined('CIVICRM_DSN') && $loadFromDB) {
         $this->fatal('You need to define CIVICRM_DSN in civicrm.settings.php');
     }
     $this->dsn = defined('CIVICRM_DSN') ? CIVICRM_DSN : NULL;
     if (!defined('CIVICRM_TEMPLATE_COMPILEDIR') && $loadFromDB) {
         $this->fatal('You need to define CIVICRM_TEMPLATE_COMPILEDIR in civicrm.settings.php');
     }
     if (defined('CIVICRM_TEMPLATE_COMPILEDIR')) {
         $this->configAndLogDir = CRM_Utils_File::baseFilePath() . 'ConfigAndLog' . DIRECTORY_SEPARATOR;
         CRM_Utils_File::createDir($this->configAndLogDir);
         CRM_Utils_File::restrictAccess($this->configAndLogDir);
         $this->templateCompileDir = defined('CIVICRM_TEMPLATE_COMPILEDIR') ? CRM_Utils_File::addTrailingSlash(CIVICRM_TEMPLATE_COMPILEDIR) : NULL;
         CRM_Utils_File::createDir($this->templateCompileDir);
         CRM_Utils_File::restrictAccess($this->templateCompileDir);
     }
     if (!defined('CIVICRM_UF')) {
         $this->fatal('You need to define CIVICRM_UF in civicrm.settings.php');
     }
     $this->userFramework = CIVICRM_UF;
     $this->userFrameworkClass = 'CRM_Utils_System_' . CIVICRM_UF;
     $this->userHookClass = 'CRM_Utils_Hook_' . CIVICRM_UF;
     if (CIVICRM_UF == 'Joomla') {
         $this->userFrameworkURLVar = 'task';
     }
     if (defined('CIVICRM_UF_DSN')) {
         $this->userFrameworkDSN = CIVICRM_UF_DSN;
     }
     // this is dynamically figured out in the civicrm.settings.php file
     if (defined('CIVICRM_CLEANURL')) {
         $this->cleanURL = CIVICRM_CLEANURL;
     } else {
         $this->cleanURL = 0;
     }
     $this->templateDir = array(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR);
     $this->initialized = 1;
 }
开发者ID:sarehag,项目名称:civicrm-core,代码行数:41,代码来源:Runtime.php

示例7: getDirectory

 /**
  * Get ConfigManager export / import location on disk.
  *
  * @return string
  */
 function getDirectory()
 {
     return \CRM_Utils_File::baseFilePath() . 'ConfigAndLog/configmgr' . DIRECTORY_SEPARATOR;
 }
开发者ID:xurizaemon,项目名称:civicrm-configexport,代码行数:9,代码来源:ConfigManager.php

示例8: _configexport_get_directory

function _configexport_get_directory()
{
    return CRM_Utils_File::baseFilePath() . 'ConfigAndLog/configmgr' . DIRECTORY_SEPARATOR;
}
开发者ID:xurizaemon,项目名称:civicrm-configexport,代码行数:4,代码来源:configexport.php


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