24use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
64 use ProtectedHookAccessorTrait;
75 private $deprecated = [];
83 wfDebug( __METHOD__ .
' was called with no Config instance passed to it' );
96 public function deprecate(
string $name,
string $version ) {
97 $this->deprecated[$name] = $version;
105 public function set( $name, $value ) {
106 $this->data[$name] = $value;
115 public function extend( $name, $value ) {
116 if ( $this->haveData( $name ) ) {
117 $this->data[$name] .= $value;
119 $this->data[$name] = $value;
126 private function checkDeprecationStatus(
string $name ) {
127 $deprecated = $this->deprecated[ $name ] ??
false;
130 'QuickTemplate::(get/html/text/haveData) with parameter `' . $name .
'`',
144 public function get( $name, $default = null ) {
145 $this->checkDeprecationStatus( $name );
146 return $this->data[$name] ?? $default;
159 protected function text( $str ) {
160 $this->checkDeprecationStatus( $str );
161 echo htmlspecialchars( $this->data[$str] );
169 $this->checkDeprecationStatus( $str );
170 echo $this->data[$str];
176 public function msg( $msgKey ) {
184 private function haveData( $str ) {
185 $this->checkDeprecationStatus( $str );
186 return isset( $this->data[$str] );
194 return !
wfMessage( $msgKey )->isDisabled();
203 return $this->data[
'skin'];
215 $html = ob_get_contents();
222class_alias( QuickTemplate::class,
'QuickTemplate' );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.