Example #1
0
 /**
  * Get the configuration value
  * @param    string   $key   key of the configuration key/value pair
  * @return   mixed    value of the configuration key/value pair
  */
 public function getValue($key)
 {
     // is this config value stored in the db?
     $db_value_config = AppConfig::getConfigValue($key);
     $value = null;
     $value = isset($this->config[$key]) ? $this->config[$key] : null;
     /*
             Profiler::debugPoint(false,__METHOD__, __FILE__, __LINE__);
     
             var_dump($db_value_config);
     
             if ($db_value_config) {
                 $option_dao = DAOFactory::getDAO("OptionDAO");
                 $db_value = $option_dao->getOptionValue(OptionDAO::APP_OPTIONS, $key, false );
                 $value =  $db_value ? $db_value : $db_value_config['default'];
                 // convert db text booleans if needed
                 if ($value == 'false') {
                     $value = false;
                 } else if ($value == 'true') {
                     $value = true;
                 }
             } else {
                 // if not a db config value, get from config file
                 $value = isset($this->config[$key]) ? $this->config[$key] : null;
             }
     */
     return $value;
 }
Example #2
0
 /**
  * Get the configuration value
  * @param    string   $key   key of the configuration key/value pair
  * @return   mixed    value of the configuration key/value pair
  */
 public function getValue($key)
 {
     // is this config value stored in the db?
     $db_value_config = AppConfig::getConfigValue($key);
     $value = null;
     if ($db_value_config) {
         $option_dao = DAOFactory::getDAO("OptionDAO");
         $db_value = $option_dao->getOptionValue(OptionDAO::APP_OPTIONS, $key, true);
         $value = $db_value ? $db_value : $db_value_config['default'];
         // convert db text booleans if needed
         if ($value == 'false') {
             $value = false;
         } else {
             if ($value == 'true') {
                 $value = true;
             }
         }
     } else {
         // if not a db config value, get from config file
         $value = isset($this->config[$key]) ? $this->config[$key] : null;
     }
     return $value;
 }