From 4c235182829ca9192e05ddaa10bd7d7914f284f6 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 28 Oct 2014 12:29:45 +1300 Subject: [PATCH] whitespace --- CRM/Core/BAO/ConfigSetting.php | 185 ++++++++++++++++++--------------- 1 file changed, 99 insertions(+), 86 deletions(-) diff --git a/CRM/Core/BAO/ConfigSetting.php b/CRM/Core/BAO/ConfigSetting.php index 34a8509e62..1e9658270e 100644 --- a/CRM/Core/BAO/ConfigSetting.php +++ b/CRM/Core/BAO/ConfigSetting.php @@ -79,8 +79,8 @@ class CRM_Core_BAO_ConfigSetting { str_replace( 'CIVI_BASE_TEMPLATE', '', - $params['civiRelativeURL'] - ); + $params['civiRelativeURL'] + ); // also add the version number for use by template / js etc $params['civiVersion'] = CRM_Utils_System::version(); @@ -317,8 +317,9 @@ class CRM_Core_BAO_ConfigSetting { $dbLocale = $multiLang ? "_{$defaults['lcMessages']}" : ''; $lcMessages = CRM_Utils_System::getUFLocale(); if ($domain->locales and !in_array($lcMessages, explode(CRM_Core_DAO::VALUE_SEPARATOR, - $domain->locales - ))) { + $domain->locales + )) + ) { $lcMessages = NULL; } } @@ -329,7 +330,7 @@ class CRM_Core_BAO_ConfigSetting { } else { // if a single-lang site or the above didn't yield a result, use default - $lcMessages = CRM_Utils_Array::value( 'lcMessages', $defaults ); + $lcMessages = CRM_Utils_Array::value('lcMessages', $defaults); } // set suffix for table names - use views if more than one language @@ -383,25 +384,23 @@ class CRM_Core_BAO_ConfigSetting { // lets use imageUploadDir since we dont mess around with its values // in the config object, lets kep it a bit generic since folks // might have different values etc - - //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths - if(DIRECTORY_SEPARATOR == '\\') - { - $dir = preg_replace( - '|civicrm[/\\\\]templates_c[/\\\\].*$|', - '', - $config->templateCompileDir + + //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths + if (DIRECTORY_SEPARATOR == '\\') { + $dir = preg_replace( + '|civicrm[/\\\\]templates_c[/\\\\].*$|', + '', + $config->templateCompileDir ); - } - else - { - $dir = preg_replace( - '|civicrm/templates_c/.*$|', - '', - $config->templateCompileDir + } + else { + $dir = preg_replace( + '|civicrm/templates_c/.*$|', + '', + $config->templateCompileDir ); - } - + } + $siteRoot = preg_replace( '|/media/civicrm/.*$|', '', @@ -418,25 +417,23 @@ class CRM_Core_BAO_ConfigSetting { // lets use imageUploadDir since we dont mess around with its values // in the config object, lets kep it a bit generic since folks // might have different values etc - - //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths - if(DIRECTORY_SEPARATOR == '\\') - { - $dir = preg_replace( - '|civicrm[/\\\\]templates_c[/\\\\].*$|', - '', - $config->templateCompileDir + + //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths + if (DIRECTORY_SEPARATOR == '\\') { + $dir = preg_replace( + '|civicrm[/\\\\]templates_c[/\\\\].*$|', + '', + $config->templateCompileDir ); - } - else - { - $dir = preg_replace( - '|civicrm/templates_c/.*$|', - '', - $config->templateCompileDir + } + else { + $dir = preg_replace( + '|civicrm/templates_c/.*$|', + '', + $config->templateCompileDir ); - } - + } + $siteRoot = preg_replace( '|/wp-content/plugins/files/civicrm/.*$|', '', @@ -453,31 +450,29 @@ class CRM_Core_BAO_ConfigSetting { // lets use imageUploadDir since we dont mess around with its values // in the config object, lets kep it a bit generic since folks // might have different values etc - - //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths - if(DIRECTORY_SEPARATOR == '\\') - { - $dir = preg_replace( - '|[/\\\\]files[/\\\\]civicrm[/\\\\].*$|', - '\\\\files\\\\', - $config->imageUploadDir + + //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths + if (DIRECTORY_SEPARATOR == '\\') { + $dir = preg_replace( + '|[/\\\\]files[/\\\\]civicrm[/\\\\].*$|', + '\\\\files\\\\', + $config->imageUploadDir ); - } - else - { - $dir = preg_replace( - '|/files/civicrm/.*$|', - '/files/', - $config->imageUploadDir + } + else { + $dir = preg_replace( + '|/files/civicrm/.*$|', + '/files/', + $config->imageUploadDir ); - } - + } + $matches = array(); if (preg_match( - '|/sites/([\w\.\-\_]+)/|', - $config->imageUploadDir, - $matches - )) { + '|/sites/([\w\.\-\_]+)/|', + $config->imageUploadDir, + $matches + )) { $siteName = $matches[1]; if ($siteName) { $siteName = "/sites/$siteName/"; @@ -492,24 +487,26 @@ class CRM_Core_BAO_ConfigSetting { return array($url, $dir, $siteName, $siteRoot); } -/** - * Return likely default settings - * @return array site settings - * -$url, - * - $dir Base Directory - * - $siteName - * - $siteRoot - */ + /** + * Return likely default settings + * @return array site settings + * -$url, + * - $dir Base Directory + * - $siteName + * - $siteRoot + */ static function getBestGuessSettings() { $config = CRM_Core_Config::singleton(); - - //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths - if(DIRECTORY_SEPARATOR == '\\') - $needle = 'civicrm[/\\\\]templates_c[/\\\\].*$'; - else - $needle = 'civicrm/templates_c/.*$'; - - $dir = preg_replace( + + //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths + if (DIRECTORY_SEPARATOR == '\\') { + $needle = 'civicrm[/\\\\]templates_c[/\\\\].*$'; + } + else { + $needle = 'civicrm/templates_c/.*$'; + } + + $dir = preg_replace( "|$needle|", '', $config->templateCompileDir @@ -525,7 +522,7 @@ class CRM_Core_BAO_ConfigSetting { * @return string * @throws Exception */ - static function doSiteMove($defaultValues = array() ) { + static function doSiteMove($defaultValues = array()) { $moveStatus = ts('Beginning site move process...') . '
'; // get the current and guessed values list($oldURL, $oldDir, $oldSiteName, $oldSiteRoot) = self::getConfigSettings(); @@ -615,7 +612,8 @@ WHERE option_group_id = ( FROM civicrm_option_group WHERE name = %3 ) '; - $params = array(1 => array($from, 'String'), + $params = array( + 1 => array($from, 'String'), 2 => array($to, 'String'), 3 => array($option, 'String'), ); @@ -624,7 +622,9 @@ WHERE option_group_id = ( } } - $moveStatus .= ts('Directory and Resource URLs have been updated in the moved database to reflect current site location.') . '
'; + $moveStatus .= + ts('Directory and Resource URLs have been updated in the moved database to reflect current site location.') . + '
'; $config = CRM_Core_Config::singleton(); @@ -691,7 +691,9 @@ WHERE option_group_id = ( static function disableComponent($componentName) { $config = CRM_Core_Config::singleton(); - if (!in_array($componentName, $config->enableComponents) || !array_key_exists($componentName, CRM_Core_Component::getComponents())) { + if (!in_array($componentName, $config->enableComponents) || + !array_key_exists($componentName, CRM_Core_Component::getComponents()) + ) { // post-condition satisified return TRUE; } @@ -732,14 +734,25 @@ WHERE option_group_id = ( */ static function skipVars() { return array( - 'dsn', 'templateCompileDir', + 'dsn', + 'templateCompileDir', 'userFrameworkDSN', 'userFramework', - 'userFrameworkBaseURL', 'userFrameworkClass', 'userHookClass', - 'userPermissionClass', 'userFrameworkURLVar', 'userFrameworkVersion', - 'newBaseURL', 'newBaseDir', 'newSiteName', 'configAndLogDir', - 'qfKey', 'gettextResourceDir', 'cleanURL', - 'locale_custom_strings', 'localeCustomStrings', + 'userFrameworkBaseURL', + 'userFrameworkClass', + 'userHookClass', + 'userPermissionClass', + 'userFrameworkURLVar', + 'userFrameworkVersion', + 'newBaseURL', + 'newBaseDir', + 'newSiteName', + 'configAndLogDir', + 'qfKey', + 'gettextResourceDir', + 'cleanURL', + 'locale_custom_strings', + 'localeCustomStrings', 'autocompleteContactSearch', 'autocompleteContactReference', 'checksumTimeout', -- 2.25.1