Merge pull request #4863 from totten/master-phpcbf4
[civicrm-core.git] / CRM / Core / BAO / ConfigSetting.php
index 1e9658270e539862d0ebabd052097efcd68824b9..48be9c9b49d5fabff31738734880f996cbe1c51f 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
 class CRM_Core_BAO_ConfigSetting {
 
   /**
-   * Function to create civicrm settings. This is the same as add but it clears the cache and
+   * Create civicrm settings. This is the same as add but it clears the cache and
    * reloads the config object
    *
-   * @params array $params associated array of civicrm variables
-   *
-   * @param $params
+   * @param array $params
+   *   Associated array of civicrm variables.
    *
    * @return null
    * @static
    */
-  static function create($params) {
+  public static function create($params) {
     self::add($params);
     $cache = CRM_Utils_Cache::singleton();
     $cache->delete('CRM_Core_Config');
@@ -60,16 +59,15 @@ class CRM_Core_BAO_ConfigSetting {
   }
 
   /**
-   * Function to add civicrm settings
-   *
-   * @params array $params associated array of civicrm variables
+   * Add civicrm settings
    *
-   * @param $params
+   * @param array $params
+   *   Associated array of civicrm variables.
    *
    * @return null
    * @static
    */
-  static function add(&$params) {
+  public static function add(&$params) {
     self::fixParams($params);
 
     // also set a template url so js files can use this
@@ -143,16 +141,15 @@ class CRM_Core_BAO_ConfigSetting {
   }
 
   /**
-   * Function to fix civicrm setting variables
-   *
-   * @params array $params associated array of civicrm variables
+   * Fix civicrm setting variables
    *
-   * @param $params
+   * @param array $params
+   *   Associated array of civicrm variables.
    *
    * @return null
    * @static
    */
-  static function fixParams(&$params) {
+  public static function fixParams(&$params) {
     // in our old civicrm.settings.php we were using ISO code for country and
     // province limit, now we have changed it to use ids
 
@@ -177,15 +174,17 @@ class CRM_Core_BAO_ConfigSetting {
   }
 
   /**
-   * Function to format the array containing before inserting in db
+   * Format the array containing before inserting in db
    *
-   * @param  array $params associated array of civicrm variables(submitted)
-   * @param  array $values associated array of civicrm variables stored in db
+   * @param array $params
+   *   Associated array of civicrm variables(submitted).
+   * @param array $values
+   *   Associated array of civicrm variables stored in db.
    *
    * @return null
    * @static
    */
-  static function formatParams(&$params, &$values) {
+  public static function formatParams(&$params, &$values) {
     if (empty($params) ||
       !is_array($params)
     ) {
@@ -202,14 +201,14 @@ class CRM_Core_BAO_ConfigSetting {
   }
 
   /**
-   * Function to retrieve the settings values from db
+   * Retrieve the settings values from db
    *
    * @param $defaults
    *
    * @return array $defaults
    * @static
    */
-  static function retrieve(&$defaults) {
+  public static function retrieve(&$defaults) {
     $domain = new CRM_Core_DAO_Domain();
 
     //we are initializing config, really can't use, CRM-7863
@@ -324,12 +323,8 @@ class CRM_Core_BAO_ConfigSetting {
         }
       }
 
-      if ($lcMessages) {
-        // update config lcMessages - CRM-5027 fixed.
-        $defaults['lcMessages'] = $lcMessages;
-      }
-      else {
-        // if a single-lang site or the above didn't yield a result, use default
+      if (empty($lcMessages)) {
+        //CRM-11993 - if a single-lang site, use default
         $lcMessages = CRM_Utils_Array::value('lcMessages', $defaults);
       }
 
@@ -370,7 +365,7 @@ class CRM_Core_BAO_ConfigSetting {
   /**
    * @return array
    */
-  static function getConfigSettings() {
+  public static function getConfigSettings() {
     $config = CRM_Core_Config::singleton();
 
     $url = $dir = $siteName = $siteRoot = NULL;
@@ -495,7 +490,7 @@ class CRM_Core_BAO_ConfigSetting {
    * - $siteName
    * - $siteRoot
    */
-  static function getBestGuessSettings() {
+  public static function getBestGuessSettings() {
     $config = CRM_Core_Config::singleton();
 
     //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths
@@ -522,7 +517,7 @@ class CRM_Core_BAO_ConfigSetting {
    * @return string
    * @throws Exception
    */
-  static function doSiteMove($defaultValues = array()) {
+  public static function doSiteMove($defaultValues = array()) {
     $moveStatus = ts('Beginning site move process...') . '<br />';
     // get the current and guessed values
     list($oldURL, $oldDir, $oldSiteName, $oldSiteRoot) = self::getConfigSettings();
@@ -659,15 +654,16 @@ WHERE  option_group_id = (
   }
 
   /**
-   * takes a componentName and enables it in the config
+   * Takes a componentName and enables it in the config
    * Primarily used during unit testing
    *
-   * @param string $componentName name of the component to be enabled, needs to be valid
+   * @param string $componentName
+   *   Name of the component to be enabled, needs to be valid.
    *
    * @return boolean - true if valid component name and enabling succeeds, else false
    * @static
    */
-  static function enableComponent($componentName) {
+  public static function enableComponent($componentName) {
     $config = CRM_Core_Config::singleton();
     if (in_array($componentName, $config->enableComponents)) {
       // component is already enabled
@@ -689,7 +685,7 @@ WHERE  option_group_id = (
     return TRUE;
   }
 
-  static function disableComponent($componentName) {
+  public static function disableComponent($componentName) {
     $config = CRM_Core_Config::singleton();
     if (!in_array($componentName, $config->enableComponents) ||
       !array_key_exists($componentName, CRM_Core_Component::getComponents())
@@ -732,7 +728,7 @@ WHERE  option_group_id = (
   /**
    * @return array
    */
-  static function skipVars() {
+  public static function skipVars() {
     return array(
       'dsn',
       'templateCompileDir',
@@ -759,4 +755,3 @@ WHERE  option_group_id = (
     );
   }
 }
-