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


PHP CRM_Utils_System::checkURL方法代码示例

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


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

示例1: formRule

 static function formRule($fields)
 {
     if (isset($fields['enableSSL']) && $fields['enableSSL']) {
         $config = CRM_Core_Config::singleton();
         $url = str_replace('http://', 'https://', CRM_Utils_System::url('civicrm/dashboard', 'reset=1', TRUE, NULL, FALSE, FALSE));
         if (!CRM_Utils_System::checkURL($url, TRUE)) {
             $errors = array('enableSSL' => ts('You need to set up a secure server before you can use the Force Secure URLs option'));
             return $errors;
         }
     }
     return TRUE;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:12,代码来源:Url.php

示例2: setValues

 /**
  * Function to set the default values
  *
  * @param array   $defaults  associated array of form elements
  * @param boolena $formMode  this funtion is called to set default
  *                           values in an empty db, also called when setting component using GUI
  *                           this variable is set true for GUI
  *                           mode (eg: Global setting >> Components)    
  *
  * @access public
  */
 public function setValues(&$defaults, $formMode = false)
 {
     $config =& CRM_Core_Config::singleton();
     $baseURL = $config->userFrameworkBaseURL;
     if ($config->templateCompileDir) {
         $path = dirname($config->templateCompileDir);
         //this fix is to avoid creation of upload dirs inside templates_c directory
         $checkPath = explode(DIRECTORY_SEPARATOR, $path);
         $cnt = count($checkPath) - 1;
         if ($checkPath[$cnt] == 'templates_c') {
             unset($checkPath[$cnt]);
             $path = implode(DIRECTORY_SEPARATOR, $checkPath);
         }
         $path = CRM_Utils_File::addTrailingSlash($path);
     }
     //set defaults if not set in db
     if (!isset($defaults['userFrameworkResourceURL'])) {
         $testIMG = "i/tracker.gif";
         if ($config->userFramework == 'Joomla') {
             if (CRM_Utils_System::checkURL("{$baseURL}components/com_civicrm/civicrm/{$testIMG}")) {
                 $defaults['userFrameworkResourceURL'] = $baseURL . "components/com_civicrm/civicrm/";
             }
         } else {
             if ($config->userFramework == 'Standalone') {
                 // potentially sane default for standalone;
                 // could probably be smarter about this, but this
                 // should work in many cases
                 $defaults['userFrameworkResourceURL'] = str_replace('standalone/', '', $baseURL);
             } 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;
                 $civicrmDirName = trim(basename($civicrm_root));
                 $defaults['userFrameworkResourceURL'] = $baseURL . "sites/all/modules/{$civicrmDirName}/";
                 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);
                         $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/";
         } else {
             if ($config->userFramework == 'Standalone') {
                 //for standalone no need of sites/defaults directory
                 $defaults['imageUploadURL'] = $baseURL . "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);
         $defaults['uploadDir'] = $uploadDir;
     }
     if (!isset($defaults['customFileUploadDir']) && is_dir($config->templateCompileDir)) {
         $customDir = $path . "custom/";
         CRM_Utils_File::createDir($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]);
     }
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdev,代码行数:101,代码来源:Defaults.php

示例3: setValues

 /**
  * Function to set the default values
  *
  * @param array   $defaults  associated array of form elements
  * @param boolena $formMode  this funtion is called to set default
  *                           values in an empty db, also called when setting component using GUI
  *                           this variable is set true for GUI
  *                           mode (eg: Global setting >> Components)    
  *
  * @access public
  */
 public 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->userFramework == '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);
     }
     //set defaults if not set in db
     if (!isset($defaults['userFrameworkResourceURL'])) {
         $testIMG = "i/tracker.gif";
         if ($config->userFramework == 'Joomla') {
             if (CRM_Utils_System::checkURL("{$baseURL}components/com_civicrm/civicrm/{$testIMG}")) {
                 $defaults['userFrameworkResourceURL'] = $baseURL . "components/com_civicrm/civicrm/";
             }
         } else {
             if ($config->userFramework == 'Standalone') {
                 // potentially sane default for standalone;
                 // could probably be smarter about this, but this
                 // should work in many cases
                 $defaults['userFrameworkResourceURL'] = str_replace('standalone/', '', $baseURL);
             } 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;
                 require_once "CRM/Utils/System/Drupal.php";
                 $cmsPath = CRM_Utils_System_Drupal::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/";
         } else {
             if ($config->userFramework == 'Standalone') {
                 //for standalone no need of sites/defaults directory
                 $defaults['imageUploadURL'] = $baseURL . "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);
         $defaults['customFileUploadDir'] = $customDir;
     }
     /* FIXME: hack to bypass the step for generating defaults for components, 
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Defaults.php


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