simetrical(a)svn.wikimedia.org wrote:
+ $templates = ($this->preview ||
$this->section) ? $this->mPreviewTemplates :
$this->mArticle->getUsedTemplates();
+ $templates = $sk->formatTemplates( $templates, $this->preview, $this->section
!= '');
As a style note: I recommend against reusing a variable for two
different types of data like this. It's confusing when reading the code,
and can be maddening when splicing new code into the middle of an
existing function that does this.
There are a lot of examples of that in older code, unfortunately, but
that shouldn't be emulated. ;)
- wfMsgExt( 'templatesused', array(
'parse' ) ) .
+ wfMsgExt( 'templatesused' . ( $preview ? 'preview' : ( $section ?
'section' : '' ) ), array( 'parse' ) ) .
I'm also not sure it's a great idea to build message key references
dynamically this way, when it's not really needed.
The way this code is, you won't be able to easily search for where the
messages "templatesusedpreview" and "templatesusedsection" get used
in
the code. That can contribute to maintenance problems later; for
instance the messages might get removed on the belief they are no longer
being used.
-- brion vibber (brion @
pobox.com)