userFrameworkBaseURL; $proxy_base = CRM_Core_BAO_Setting::getItem('CiviProxy Settings', 'proxy_url'); // fields to replace: $fields2replace = array('html', 'text'); foreach ($fields2replace as $field) { $value = $params[$field]; // General external functions $value = preg_replace("#{$system_base}sites/all/modules/civicrm/extern/url.php#i", $proxy_base.'/url.php', $value); $value = preg_replace("#{$system_base}sites/all/modules/civicrm/extern/open.php#i", $proxy_base.'/open.php', $value); $value = preg_replace("#{$system_base}sites/default/files/civicrm/persist/#i", $proxy_base.'/file.php?id=', $value); // Mailing related functions $value = preg_replace("#{$system_base}civicrm/mailing/view#i", $proxy_base.'/mailing/mail.php', $value); $custom_mailing_base = CRM_Core_BAO_Setting::getItem('CiviProxy Settings', 'custom_mailing_base'); foreach ($other_mailing_functions as $function) { if (empty($custom_mailing_base)) { $new_url = "{$proxy_base}/mailing/{$function}.php"; } else { $new_url = "{$custom_mailing_base}/{$function}.php"; } $value = preg_replace("#{$system_base}civicrm/mailing/{$function}#i", $new_url, $value); } $params[$field] = $value; } } /** * Implementation of hook_civicrm_config */ function civiproxy_civicrm_config(&$config) { _civiproxy_civix_civicrm_config($config); } /** * Implementation of hook_civicrm_xmlMenu * * @param $files array(string) */ function civiproxy_civicrm_xmlMenu(&$files) { _civiproxy_civix_civicrm_xmlMenu($files); } /** * Implementation of hook_civicrm_install */ function civiproxy_civicrm_install() { return _civiproxy_civix_civicrm_install(); } /** * Implementation of hook_civicrm_uninstall */ function civiproxy_civicrm_uninstall() { return _civiproxy_civix_civicrm_uninstall(); } /** * Implementation of hook_civicrm_enable */ function civiproxy_civicrm_enable() { return _civiproxy_civix_civicrm_enable(); } /** * Implementation of hook_civicrm_disable */ function civiproxy_civicrm_disable() { return _civiproxy_civix_civicrm_disable(); } /** * Implementation of hook_civicrm_upgrade * * @param $op string, the type of operation being performed; 'check' or 'enqueue' * @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks * * @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending) * for 'enqueue', returns void */ function civiproxy_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { return _civiproxy_civix_civicrm_upgrade($op, $queue); } /** * Implementation of hook_civicrm_managed * * Generate a list of entities to create/deactivate/delete when this module * is installed, disabled, uninstalled. */ function civiproxy_civicrm_managed(&$entities) { return _civiproxy_civix_civicrm_managed($entities); } /** * Implementation of hook_civicrm_caseTypes * * Generate a list of case-types * * Note: This hook only runs in CiviCRM 4.4+. */ function civiproxy_civicrm_caseTypes(&$caseTypes) { _civiproxy_civix_civicrm_caseTypes($caseTypes); } /** * Implementation of hook_civicrm_alterSettingsFolders * * Scan for settings in custom folder and import them * */ function civiproxy_civicrm_alterSettingsFolders(&$metaDataFolders = NULL){ static $configured = FALSE; if ($configured) return; $configured = TRUE; $extRoot = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; $extDir = $extRoot . 'settings'; if(!in_array($extDir, $metaDataFolders)){ $metaDataFolders[] = $extDir; } }