10use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
50 use ProtectedHookAccessorTrait;
61 private $deprecated = [];
69 wfDebug( __METHOD__ .
' was called with no Config instance passed to it' );
82 public function deprecate(
string $name,
string $version ) {
83 $this->deprecated[$name] = $version;
91 public function set( $name, $value ) {
92 $this->data[$name] = $value;
101 public function extend( $name, $value ) {
102 if ( $this->haveData( $name ) ) {
103 $this->data[$name] .= $value;
105 $this->data[$name] = $value;
112 private function checkDeprecationStatus(
string $name ) {
113 $deprecated = $this->deprecated[ $name ] ??
false;
116 'QuickTemplate::(get/html/text/haveData) with parameter `' . $name .
'`',
130 public function get( $name, $default = null ) {
131 $this->checkDeprecationStatus( $name );
132 return $this->data[$name] ?? $default;
145 protected function text( $str ) {
146 $this->checkDeprecationStatus( $str );
147 echo htmlspecialchars( $this->data[$str] );
155 $this->checkDeprecationStatus( $str );
156 echo $this->data[$str];
162 public function msg( $msgKey ) {
170 private function haveData( $str ) {
171 $this->checkDeprecationStatus( $str );
172 return isset( $this->data[$str] );
180 return !
wfMessage( $msgKey )->isDisabled();
189 return $this->data[
'skin'];
201 $html = ob_get_contents();
208class_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.