X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fskins%2FBaseTemplate.php;h=5c4d812889d3df5cf2b6df49aaafcd6a9652665d;hb=15337aa42c8831b34dc3c17b1c0a5a4339cd148b;hp=156df67f2eb49b46784f19d031a6530aa15c20b4;hpb=2542abb6f615cc5c86e0192ec906b500cbdd7df3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/skins/BaseTemplate.php b/includes/skins/BaseTemplate.php index 156df67f2e..5c4d812889 100644 --- a/includes/skins/BaseTemplate.php +++ b/includes/skins/BaseTemplate.php @@ -36,7 +36,7 @@ abstract class BaseTemplate extends QuickTemplate { * @return Message */ public function getMsg( $name /* ... */ ) { - return call_user_func_array( [ $this->getSkin(), 'msg' ], func_get_args() ); + return $this->getSkin()->msg( ...func_get_args() ); } function msg( $str ) { @@ -366,7 +366,7 @@ abstract class BaseTemplate extends QuickTemplate { if ( isset( $item['text'] ) ) { $text = $item['text']; } else { - $text = wfMessage( isset( $item['msg'] ) ? $item['msg'] : $key )->text(); + $text = wfMessage( $item['msg'] ?? $key )->text(); } $html = htmlspecialchars( $text ); @@ -378,9 +378,7 @@ abstract class BaseTemplate extends QuickTemplate { } while ( count( $wrapper ) > 0 ) { $element = array_pop( $wrapper ); - $html = Html::rawElement( $element['tag'], isset( $element['attributes'] ) - ? $element['attributes'] - : null, $html ); + $html = Html::rawElement( $element['tag'], $element['attributes'] ?? null, $html ); } } @@ -517,7 +515,7 @@ abstract class BaseTemplate extends QuickTemplate { if ( isset( $item['itemtitle'] ) ) { $attrs['title'] = $item['itemtitle']; } - return Html::rawElement( isset( $options['tag'] ) ? $options['tag'] : 'li', $attrs, $html ); + return Html::rawElement( $options['tag'] ?? 'li', $attrs, $html ); } function makeSearchInput( $attrs = [] ) { @@ -561,11 +559,9 @@ abstract class BaseTemplate extends QuickTemplate { unset( $buttonAttrs['height'] ); $imgAttrs = [ 'src' => $attrs['src'], - 'alt' => isset( $attrs['alt'] ) - ? $attrs['alt'] - : wfMessage( 'searchbutton' )->text(), - 'width' => isset( $attrs['width'] ) ? $attrs['width'] : null, - 'height' => isset( $attrs['height'] ) ? $attrs['height'] : null, + 'alt' => $attrs['alt'] ?? wfMessage( 'searchbutton' )->text(), + 'width' => $attrs['width'] ?? null, + 'height' => $attrs['height'] ?? null, ]; return Html::rawElement( 'button', $buttonAttrs, Html::element( 'img', $imgAttrs ) ); default: @@ -579,7 +575,7 @@ abstract class BaseTemplate extends QuickTemplate { * If you pass "flat" as an option then the returned array will be a flat array * of footer icons instead of a key/value array of footerlinks arrays broken * up into categories. - * @param string $option + * @param string|null $option * @return array|mixed */ function getFooterLinks( $option = null ) { @@ -601,10 +597,7 @@ abstract class BaseTemplate extends QuickTemplate { if ( $option == 'flat' ) { // fold footerlinks into a single array using a bit of trickery - $validFooterLinks = call_user_func_array( - 'array_merge', - array_values( $validFooterLinks ) - ); + $validFooterLinks = array_merge( ...array_values( $validFooterLinks ) ); } return $validFooterLinks; @@ -619,7 +612,7 @@ abstract class BaseTemplate extends QuickTemplate { * in the list of footer icons. This is mostly useful for skins which only * display the text from footericons instead of the images and don't want a * duplicate copyright statement because footerlinks already rendered one. - * @param string $option + * @param string|null $option * @return array */ function getFooterIcons( $option = null ) {