src-dev/Mouf/Controllers/ConfigController.php
public function registerConstant($name, $comment, $type, $defaultvalue = "", $value = "", $selfedit = "false", $fetchFromEnv = "false") {
		$this->selfedit = $selfedit;
		
		if ($selfedit == "true") {
			$this->moufManager = MoufManager::getMoufManager();
		} else {
			$this->moufManager = MoufManager::getMoufManagerHiddenInstance();
		}
		$this->configManager = $this->moufManager->getConfigManager();
		
		if ($type == "int") {
		    $value = $value !== '' ? (int) $value : '';
			$defaultvalue = $defaultvalue !== '' ? (int) $defaultvalue : '';
		} else if ($type == "float") {
			$value = (float) $value;
			$defaultvalue = (float) $defaultvalue;
		} else if ($type == "bool") {
			if ($value == "true") {
				$value = true;
			} else {
				$value = false;
			}
			if ($defaultvalue == "true") {
				$defaultvalue = true;
			} else {
				$defaultvalue = false;
			}
		}
		
		$this->configManager->registerConstant($name, $type, $defaultvalue, $comment, $fetchFromEnv === 'true');
		$this->moufManager->rewriteMouf();
		
		// Now, let's write the constant for our environment:
		$this->constantsList = $this->configManager->getDefinedConstants();
		$this->constantsList[$name] = $value;
		$this->configManager->setDefinedConstants($this->constantsList);
		
		header("Location: .?selfedit=".$selfedit);
	}
public function registerConstant($name, $comment, $type, $defaultvalue = "", $value = "", $selfedit = "false", $fetchFromEnv = "false") {
		$this->selfedit = $selfedit;
		
		if ($selfedit == "true") {
			$this->moufManager = MoufManager::getMoufManager();
		} else {
			$this->moufManager = MoufManager::getMoufManagerHiddenInstance();
		}
		$this->configManager = $this->moufManager->getConfigManager();
		
		if ($type == "int") {
		    $value = $value !== '' ? (int) $value : '';
			$defaultvalue = $defaultvalue !== '' ? (int) $defaultvalue : '';
		} else if ($type == "float") {
			$value = (float) $value;
			$defaultvalue = (float) $defaultvalue;
		} else if ($type == "bool") {
			if ($value == "true") {
				$value = true;
			} else {
				$value = false;
			}
			if ($defaultvalue == "true") {
				$defaultvalue = true;
			} else {
				$defaultvalue = false;
			}
		}
		
		$this->configManager->registerConstant($name, $type, $defaultvalue, $comment, $fetchFromEnv === 'true');
		$this->moufManager->rewriteMouf();
		
		// Now, let's write the constant for our environment:
		$this->constantsList = $this->configManager->getDefinedConstants();
		$this->constantsList[$name] = $value;
		$this->configManager->setDefinedConstants($this->constantsList);
		
		header("Location: .?selfedit=".$selfedit);
	}
public function registerConstant ( $ name , $ comment , $ type , $ defaultvalue = "" , $ value = "" , $ selfedit = "false" , $ fetchFromEnv = "false" ) { $ this -> selfedit = $ selfedit ; if ( $ selfedit == "true" ) { $ this -> moufManager = MoufManager :: getMoufManager ( ) ; } else { $ this -> moufManager = MoufManager :: getMoufManagerHiddenInstance ( ) ; } $ this -> configManager = $ this -> moufManager -> getConfigManager ( ) ; if ( $ type == "int" ) { $ value = $ value !== '' ? ( int ) $ value : '' ; $ defaultvalue = $ defaultvalue !== '' ? ( int ) $ defaultvalue : '' ; } else if ( $ type == "float" ) { $ value = ( float ) $ value ; $ defaultvalue = ( float ) $ defaultvalue ; } else if ( $ type == "bool" ) { if ( $ value == "true" ) { $ value = true ; } else { $ value = false ; } if ( $ defaultvalue == "true" ) { $ defaultvalue = true ; } else { $ defaultvalue = false ; } } $ this -> configManager -> registerConstant ( $ name , $ type , $ defaultvalue , $ comment , $ fetchFromEnv === 'true' ) ; $ this -> moufManager -> rewriteMouf ( ) ; // Now, let's write the constant for our environment:
 $ this -> constantsList = $ this -> configManager -> getDefinedConstants ( ) ; $ this -> constantsList [ $ name ] = $ value ; $ this -> configManager -> setDefinedConstants ( $ this -> constantsList ) ; header ( "Location: .?selfedit=" . $ selfedit ) ; }
Actually saves the new constant declared.

@Action
@Logged
@param string $name
@param string $defaultvalue
@param string $value
@param string $comment
@param string $type
@param string $selfedit
Actually saves the new constant declared .