r25606 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25605‎ | r25606 | r25607 >
Date:06:01, 7 September 2007
Author:david
Status:old
Tags:
Comment:
some optimization of showThreadFooter
Modified paths:
  • /branches/liquidthreads/extensions/LqtBaseView.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtBaseView.php
@@ -507,32 +507,35 @@
508508 function showThreadFooter( $thread ) {
509509 global $wgLang; // TODO global.
510510
511 - $color_number = $this->selectNewUserColor( $thread->root()->originalAuthor() );
512 - $this->output->addHTML(wfOpenElement('ul', array('class'=>"lqt_footer" )));
513 -
514 - $this->output->addHTML( wfOpenElement( 'li', array('class'=>"lqt_author_sig lqt_post_color_$color_number") ) );
515 - $p = new Parser(); $sig = $p->getUserSig( $thread->root()->originalAuthor() );
516 - $this->output->addWikitext( $sig, false );
517 - $this->output->addHTML( wfCloseElement( 'li' ) );
 511+ $thread_author = $thread->root()->originalAuthor();
 512+ $color_number = $this->selectNewUserColor($thread_author);
 513+ $p = new Parser(); $sig = $p->getUserSig($thread_author);
 514+ $timestamp = $wgLang->timeanddate($thread->timestamp());
518515
519 - $this->output->addHTML( wfOpenElement( 'li' ) );
520 - $this->output->addHTML( $wgLang->timeanddate($thread->timestamp()) );
521 - $this->output->addHTML( wfCloseElement( 'li' ) );
 516+ $this->output->addHTML(<<<HTML
 517+<ul class="lqt_footer">
 518+<li class="lqt_author_sig lqt_post_color_{$color_number}">
 519+HTML
 520+);
 521+ $this->output->addWikitext($sig); #gah!
 522+ $this->output->addHTML(<<<HTML
 523+</li>
 524+<li>$timestamp</li>
 525+HTML
 526+);
522527
523528 foreach( $this->applicableThreadCommands($thread) as $command ) {
524529 $label = $command['label'];
525530 $href = $command['href'];
526531 $enabled = $command['enabled'];
527 - $this->output->addHTML( wfOpenElement( 'li' ) );
 532+
528533 if( $enabled ) {
529 - $this->output->addHTML( wfElement('a', array('href'=>$href), $label) );
 534+ $this->output->addHTML( "<li><a href=\"$href\">$label</a></li>" );
530535 } else {
531 - $this->output->addHTML( wfElement('span', array('class'=>'lqt_footer_disabled'), $label) );
 536+ $this->output->addHTML( "<li><span class=\"lqt_footer_disabled\">$label</span></li>" );
532537 }
533 - $this->output->addHTML( wfCloseElement( 'li' ) );
534538 }
535 -
536 - $this->output->addHTML(wfCloseELement('ul'));
 539+ $this->output->addHTML('</ul>');
537540 }
538541
539542 function selectNewUserColor( $user ) {

Status & tagging log