From: Sam Reed Date: Thu, 24 Feb 2011 23:03:55 +0000 (+0000) Subject: Refactor code a little bit, save doing redundant checks if known not necessary. X-Git-Tag: 1.31.0-rc.0~31780 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=13abc68f1695349dac62f810ae93233049781329;p=lhc%2Fweb%2Fwiklou.git Refactor code a little bit, save doing redundant checks if known not necessary. Improves flow a little --- diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index ab9c12ab34..fba6068da1 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -253,23 +253,23 @@ class ApiParse extends ApiBase { if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) { $out = new OutputPage; $out->addParserOutputNoText( $p_result ); - $userSkin = $wgUser->getSkin(); - } - if ( isset( $prop['headitems'] ) ) { - $headItems = $this->formatHeadItems( $p_result->getHeadItems() ); + if ( isset( $prop['headitems'] ) ) { + $headItems = $this->formatHeadItems( $p_result->getHeadItems() ); - $userSkin->setupUserCss( $out ); - $css = $this->formatCss( $out->buildCssLinksArray() ); + $userSkin = $wgUser->getSkin(); + $userSkin->setupUserCss( $out ); + $css = $this->formatCss( $out->buildCssLinksArray() ); - $scripts = array( $out->getHeadScripts( $userSkin ) ); + $scripts = array( $out->getHeadScripts( $userSkin ) ); - $result_array['headitems'] = array_merge( $headItems, $css, $scripts ); - } + $result_array['headitems'] = array_merge( $headItems, $css, $scripts ); + } - if ( isset( $prop['headhtml'] ) ) { - $result_array['headhtml'] = array(); - $result->setContent( $result_array['headhtml'], $out->headElement( $userSkin ) ); + if ( isset( $prop['headhtml'] ) ) { + $result_array['headhtml'] = array(); + $result->setContent( $result_array['headhtml'], $out->headElement( $userSkin ) ); + } } if ( isset( $prop['iwlinks'] ) ) {