22use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
62 use ProtectedHookAccessorTrait;
73 private $deprecated = [];
81 wfDebug( __METHOD__ .
' was called with no Config instance passed to it' );
82 $config = MediaWikiServices::getInstance()->getMainConfig();
94 public function deprecate(
string $name,
string $version ) {
95 $this->deprecated[$name] = $version;
103 public function set( $name, $value ) {
104 $this->data[$name] = $value;
113 public function extend( $name, $value ) {
114 if ( $this->haveData( $name ) ) {
115 $this->data[$name] .= $value;
117 $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] );
195 return $msg->exists() && !$msg->isDisabled();
204 return $this->data[
'skin'];
216 $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.