public function msg( $key = 0, $options = [], $fail = null ) {
		if ( !IntuitionUtil::nonEmptyStr( $key ) ) {
			// Invalid message key
			return $this->bracketMsg( $key, $fail );
		}

		$defaultOptions = [
			'domain' => $this->getDomain(),
			'lang' => $this->getLang(),
			'variables' => [],
			'raw-variables' => false,
			'escape' => 'plain',
			'parsemag' => true,
			'externallinks' => false,
			// Set to a wiki article path for converting
			'wikilinks' => false,
		];

		// If $options was a domain string, convert it now.
		if ( IntuitionUtil::nonEmptyStr( $options ) ) {
			$options = [ 'domain' => $options ];
		}

		// If $options is still not an array, ignore it and use default
		// Otherwise merge the options with the defaults.
		if ( !is_array( $options ) ) {
			// @codeCoverageIgnoreStart
			$options = $defaultOptions;
		} else {
			// @codeCoverageIgnoreEnd
			$options = array_merge( $defaultOptions, $options );
		}

		// Normalise key. First character is case-insensitive.
		$key = lcfirst( $key );

		$msg = $this->rawMsg( $options['domain'], $options['lang'], $key );
		if ( $msg === null ) {
			$this->errTrigger(
				"Message \"$key\" for lang \"{$options['lang']}\" in domain \"{$options['domain']}\" not found",
				__METHOD__,
				E_NOTICE
			);
			return $this->bracketMsg( $key, $fail );
		}

		// Now that we've got the message, apply any post processing
		$escapeDone = false;

		// If using raw variables, escape message before replacement
		if ( $options['raw-variables'] === true ) {
			$msg = IntuitionUtil::strEscape( $msg, $options['escape'] );
			$escapeDone = true;
		}

		// Replace variables
		foreach ( $options['variables'] as $i => $val ) {
			$n = $i + 1;
			$msg = str_replace( "\$$n", $val, $msg );
		}

		if ( $options['parsemag'] === true ) {
			$msg = $this->getMessagesFunctions()->parse( $msg, $options['lang'] );
		}

		// If not using raw vars, escape the message now (after variable replacement).
		if ( !$escapeDone ) {
			$escapeDone = true;
			$msg = IntuitionUtil::strEscape( $msg, $options['escape'] );
		}

		if ( is_string( $options['wikilinks'] ) ) {
			$msg = IntuitionUtil::parseWikiLinks( $msg, $options['wikilinks'] );
		}

		if ( $options['externallinks'] ) {
			$msg = IntuitionUtil::parseExternalLinks( $msg );
		}

		return $msg;
	}
public function msg( $key = 0, $options = [], $fail = null ) {
		if ( !IntuitionUtil::nonEmptyStr( $key ) ) {
			// Invalid message key
			return $this->bracketMsg( $key, $fail );
		}

		$defaultOptions = [
			'domain' => $this->getDomain(),
			'lang' => $this->getLang(),
			'variables' => [],
			'raw-variables' => false,
			'escape' => 'plain',
			'parsemag' => true,
			'externallinks' => false,
			// Set to a wiki article path for converting
			'wikilinks' => false,
		];

		// If $options was a domain string, convert it now.
		if ( IntuitionUtil::nonEmptyStr( $options ) ) {
			$options = [ 'domain' => $options ];
		}

		// If $options is still not an array, ignore it and use default
		// Otherwise merge the options with the defaults.
		if ( !is_array( $options ) ) {
			// @codeCoverageIgnoreStart
			$options = $defaultOptions;
		} else {
			// @codeCoverageIgnoreEnd
			$options = array_merge( $defaultOptions, $options );
		}

		// Normalise key. First character is case-insensitive.
		$key = lcfirst( $key );

		$msg = $this->rawMsg( $options['domain'], $options['lang'], $key );
		if ( $msg === null ) {
			$this->errTrigger(
				"Message \"$key\" for lang \"{$options['lang']}\" in domain \"{$options['domain']}\" not found",
				__METHOD__,
				E_NOTICE
			);
			return $this->bracketMsg( $key, $fail );
		}

		// Now that we've got the message, apply any post processing
		$escapeDone = false;

		// If using raw variables, escape message before replacement
		if ( $options['raw-variables'] === true ) {
			$msg = IntuitionUtil::strEscape( $msg, $options['escape'] );
			$escapeDone = true;
		}

		// Replace variables
		foreach ( $options['variables'] as $i => $val ) {
			$n = $i + 1;
			$msg = str_replace( "\$$n", $val, $msg );
		}

		if ( $options['parsemag'] === true ) {
			$msg = $this->getMessagesFunctions()->parse( $msg, $options['lang'] );
		}

		// If not using raw vars, escape the message now (after variable replacement).
		if ( !$escapeDone ) {
			$escapeDone = true;
			$msg = IntuitionUtil::strEscape( $msg, $options['escape'] );
		}

		if ( is_string( $options['wikilinks'] ) ) {
			$msg = IntuitionUtil::parseWikiLinks( $msg, $options['wikilinks'] );
		}

		if ( $options['externallinks'] ) {
			$msg = IntuitionUtil::parseExternalLinks( $msg );
		}

		return $msg;
	}
public function msg ( $ key = 0 , $ options = [ ] , $ fail = null ) { if ( ! IntuitionUtil :: nonEmptyStr ( $ key ) ) { // Invalid message key return $ this -> bracketMsg ( $ key , $ fail ) ; } $ defaultOptions = [ 'domain' => $ this -> getDomain ( ) , 'lang' => $ this -> getLang ( ) , 'variables' => [ ] , 'raw-variables' => false , 'escape' => 'plain' , 'parsemag' => true , 'externallinks' => false , // Set to a wiki article path for converting 'wikilinks' => false , ] ; // If $options was a domain string, convert it now. if ( IntuitionUtil :: nonEmptyStr ( $ options ) ) { $ options = [ 'domain' => $ options ] ; } // If $options is still not an array, ignore it and use default // Otherwise merge the options with the defaults. if ( ! is_array ( $ options ) ) { // @codeCoverageIgnoreStart $ options = $ defaultOptions ; } else { // @codeCoverageIgnoreEnd $ options = array_merge ( $ defaultOptions , $ options ) ; } // Normalise key. First character is case-insensitive. $ key = lcfirst ( $ key ) ; $ msg = $ this -> rawMsg ( $ options [ 'domain' ] , $ options [ 'lang' ] , $ key ) ; if ( $ msg === null ) { $ this -> errTrigger ( "Message \"$key\" for lang \"{$options['lang']}\" in domain \"{$options['domain']}\" not found" , __METHOD__ , E_NOTICE ) ; return $ this -> bracketMsg ( $ key , $ fail ) ; } // Now that we've got the message, apply any post processing $ escapeDone = false ; // If using raw variables, escape message before replacement if ( $ options [ 'raw-variables' ] === true ) { $ msg = IntuitionUtil :: strEscape ( $ msg , $ options [ 'escape' ] ) ; $ escapeDone = true ; } // Replace variables foreach ( $ options [ 'variables' ] as $ i => $ val ) { $ n = $ i + 1 ; $ msg = str_replace ( "\$$n" , $ val , $ msg ) ; } if ( $ options [ 'parsemag' ] === true ) { $ msg = $ this -> getMessagesFunctions ( ) -> parse ( $ msg , $ options [ 'lang' ] ) ; } // If not using raw vars, escape the message now (after variable replacement). if ( ! $ escapeDone ) { $ escapeDone = true ; $ msg = IntuitionUtil :: strEscape ( $ msg , $ options [ 'escape' ] ) ; } if ( is_string ( $ options [ 'wikilinks' ] ) ) { $ msg = IntuitionUtil :: parseWikiLinks ( $ msg , $ options [ 'wikilinks' ] ) ; } if ( $ options [ 'externallinks' ] ) { $ msg = IntuitionUtil :: parseExternalLinks ( $ msg ) ; } return $ msg ; }
Get a message from the message blob.

@param string $key Message key to retrieve a message for.
@param string|array $options [optional] A domain name or an array with one or more
of the following options:
- domain: overrides the currently selected domain, and if needed loads it from disk
- lang: overrides the currently selected language
- variables: numerical array to do variable replacements ($1> var[0], $2> var[1], etc.)
- raw-variables: boolean to determine whether the variables should be escaped as well
- parsemag: boolean to determine whether the message sould be tranformed
using magic phrases (PLURAL, etc.)
- escape: Optionally the return can be escaped. By default this takes place after variable
replacement. Set 'raw-variables' to true if you just want the raw message
to be escaped and have escaped the variables already.
- * 'plain'
- * 'html' (<>"& escaped)
- * 'htmlspecialchars' (alias of 'html')
- * 'htmlentities' (foreign/UTF-8 chars converted as well)

@param mixed|null $fail [optional] Value if the message doesn't exist. Defaults to null.
@return string|null
Get a message from the message blob .