r62838 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62837‎ | r62838 | r62839 >
Date:20:27, 22 February 2010
Author:ashley
Status:ok
Tags:
Comment:
ApiExpandTemplates.php: fix copyright symbol, coding style tweaks, more braces
Modified paths:
  • /trunk/phase3/includes/api/ApiExpandTemplates.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiExpandTemplates.php
@@ -1,11 +1,11 @@
22 <?php
33
4 -/*
 4+/**
55 * Created on Oct 05, 2007
66 *
77 * API for MediaWiki 1.8+
88 *
9 - * Copyright (C) 2007 Yuri Astrakhan <Firstname><Lastname>@gmail.com
 9+ * Copyright © 2007 Yuri Astrakhan <Firstname><Lastname>@gmail.com
1010 *
1111 * This program is free software; you can redistribute it and/or modify
1212 * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
2626
2727 if ( !defined( 'MEDIAWIKI' ) ) {
2828 // Eclipse helper - will be ignored in production
29 - require_once ( "ApiBase.php" );
 29+ require_once( "ApiBase.php" );
3030 }
3131
3232 /**
@@ -38,7 +38,7 @@
3939 class ApiExpandTemplates extends ApiBase {
4040
4141 public function __construct( $main, $action ) {
42 - parent :: __construct( $main, $action );
 42+ parent::__construct( $main, $action );
4343 }
4444
4545 public function execute() {
@@ -46,18 +46,18 @@
4747 $params = $this->extractRequestParams();
4848
4949 // Create title for parser
50 - $title_obj = Title :: newFromText( $params['title'] );
51 - if ( !$title_obj )
52 - $title_obj = Title :: newFromText( "API" ); // default
 50+ $title_obj = Title::newFromText( $params['title'] );
 51+ if ( !$title_obj ) {
 52+ $title_obj = Title::newFromText( 'API' ); // default
 53+ }
5354
5455 $result = $this->getResult();
5556
5657 // Parse text
5758 global $wgParser;
5859 $options = new ParserOptions();
59 -
60 - if ( $params['generatexml'] )
61 - {
 60+
 61+ if ( $params['generatexml'] ) {
6262 $wgParser->startExternalParse( $title_obj, $options, OT_PREPROCESS );
6363 $dom = $wgParser->preprocessToDom( $params['text'] );
6464 if ( is_callable( array( $dom, 'saveXML' ) ) ) {
@@ -78,9 +78,9 @@
7979 }
8080
8181 public function getAllowedParams() {
82 - return array (
 82+ return array(
8383 'title' => array(
84 - ApiBase :: PARAM_DFLT => 'API',
 84+ ApiBase::PARAM_DFLT => 'API',
8585 ),
8686 'text' => null,
8787 'generatexml' => false,
@@ -88,7 +88,7 @@
8989 }
9090
9191 public function getParamDescription() {
92 - return array (
 92+ return array(
9393 'text' => 'Wikitext to convert',
9494 'title' => 'Title of page',
9595 'generatexml' => 'Generate XML parse tree',
@@ -100,7 +100,7 @@
101101 }
102102
103103 protected function getExamples() {
104 - return array (
 104+ return array(
105105 'api.php?action=expandtemplates&text={{Project:Sandbox}}'
106106 );
107107 }

Status & tagging log