21use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
61 use ProtectedHookAccessorTrait;
72 private $deprecated = [];
80 wfDebug( __METHOD__ .
' was called with no Config instance passed to it' );
81 $config = MediaWikiServices::getInstance()->getMainConfig();
93 public function deprecate(
string $name,
string $version ) {
94 $this->deprecated[$name] = $version;
102 public function set( $name, $value ) {
103 $this->data[$name] = $value;
112 public function extend( $name, $value ) {
113 if ( $this->haveData( $name ) ) {
114 $this->data[$name] .= $value;
116 $this->data[$name] = $value;
125 private function checkDeprecationStatus(
string $name ) {
126 $deprecated = $this->deprecated[ $name ] ??
false;
129 'QuickTemplate::(get/html/text/haveData) with parameter `' . $name .
'`',
143 public function get( $name, $default = null ) {
144 $this->checkDeprecationStatus( $name );
145 return $this->data[$name] ?? $default;
158 protected function text( $str ) {
159 $this->checkDeprecationStatus( $str );
160 echo htmlspecialchars( $this->data[$str] );
168 $this->checkDeprecationStatus( $str );
169 echo $this->data[$str];
175 public function msg( $msgKey ) {
183 private function haveData( $str ) {
184 $this->checkDeprecationStatus( $str );
185 return isset( $this->data[$str] );
194 return $msg->exists() && !$msg->isDisabled();
203 return $this->data[
'skin'];
215 $html = ob_get_contents();
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.
PHP-based skin template that holds data.
getSkin()
Get the Skin object related to this object.
__construct(Config $config=null)
getHTML()
Fetch the output of a QuickTemplate and return it.
extend( $name, $value)
extends the value of data with name $name with the value $value
execute()
Main function, used by classes that subclass QuickTemplate to show the actual HTML output.
deprecate(string $name, string $version)
Sets a template key as deprecated.
Interface for configuration instances.