r93743 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93742‎ | r93743 | r93744 >
Date:13:58, 2 August 2011
Author:siebrand
Status:deferred
Tags:
Comment:
Update whitespace and markup @todo properly.
Modified paths:
  • /trunk/extensions/SemanticMaps/includes/queryprinters/SM_KMLPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/includes/queryprinters/SM_KMLPrinter.php
@@ -11,10 +11,9 @@
1212 * @author Jeroen De Dauw
1313 */
1414 class SMKMLPrinter extends SMWResultPrinter {
15 -
1615 /**
1716 * Constructor.
18 - *
 17+ *
1918 * @param $format String
2019 * @param $inline
2120 */
@@ -22,7 +21,7 @@
2322 parent::__construct( $format, $inline );
2423 $this->useValidator = true;
2524 }
26 -
 25+
2726 /**
2827 * Handler of the print request.
2928 *
@@ -30,7 +29,7 @@
3130 *
3231 * @param SMWQueryResult $res
3332 * @param $outputmode
34 - *
 33+ *
3534 * @return array
3635 */
3736 public function getResultText( SMWQueryResult $res, $outputmode ) {
@@ -41,51 +40,51 @@
4241 return $this->getLink( $res, $outputmode );
4342 }
4443 }
45 -
 44+
4645 /**
4746 * @see SMWResultPrinter::handleParameters
48 - *
 47+ *
4948 * @since 1.0
50 - *
 49+ *
5150 * @param array $params
5251 * @param $outputmode
5352 */
5453 protected function handleParameters( array $params, $outputmode ) {
5554 $this->m_params = $params;
5655 }
57 -
 56+
5857 /**
5958 * Returns a list of parameter definitions.
60 - *
 59+ *
6160 * @since 0.7.4
62 - *
 61+ *
6362 * @return array
6463 */
6564 public function getParameters() {
6665 global $egMapsDefaultLabel, $egMapsDefaultTitle;
67 -
 66+
6867 $params = array_merge( parent::getParameters(), $this->exportFormatParameters() );
69 -
 68+
7069 $params['text'] = new Parameter( 'text', Parameter::TYPE_STRING, $egMapsDefaultLabel );
7170 //$params['text']->setDescription();
72 -
 71+
7372 $params['title'] = new Parameter( 'title', Parameter::TYPE_STRING, $egMapsDefaultTitle );
74 -
 73+
7574 $params[] = new Parameter( 'linkabsolute', Parameter::TYPE_BOOLEAN, true );
76 -
 75+
7776 $params['pagelinktext'] = new Parameter( 'pagelinktext', Parameter::TYPE_STRING, wfMsg( 'semanticmaps-default-kml-pagelink' ) );
7877
7978 return $params;
8079 }
81 -
 80+
8281 /**
8382 * Returns the KML for the query result.
84 - *
 83+ *
8584 * @since 0.7.3
86 - *
 85+ *
8786 * @param SMWQueryResult $res
8887 * @param integer $outputmode
89 - *
 88+ *
9089 * @return string
9190 */
9291 protected function getKML( SMWQueryResult $res, $outputmode ) {
@@ -93,32 +92,30 @@
9493 $queryHandler->setText( $this->m_params['text'] );
9594 $queryHandler->setTitle( $this->m_params['title'] );
9695 $queryHandler->setSubjectSeparator( '' );
97 -
 96+
9897 $formatter = new MapsKMLFormatter( $this->m_params );
9998 $formatter->addPlacemarks( $queryHandler->getLocations() );
100 -
 99+
101100 return $formatter->getKML();
102101 }
103 -
 102+
104103 /**
105104 * Returns a link (HTML) pointing to a query that returns the actual KML file.
106 - *
 105+ *
107106 * @since 0.7.3
108 - *
 107+ *
109108 * @param SMWQueryResult $res
110109 * @param integer $outputmode
111 - *
 110+ *
112111 * @return string
113 - */
 112+ */
114113 protected function getLink( SMWQueryResult $res, $outputmode ) {
115114 $searchLabel = $this->getSearchLabel( $outputmode );
116115 $link = $res->getQueryLink( $searchLabel ? $searchLabel : wfMsgForContent( 'semanticmaps-kml-link' ) );
117116 $link->setParameter( 'kml', 'format' );
118 -
119117 $link->setParameter( $this->m_params['linkabsolute'] ? 'yes' : 'no', 'linkabsolute' );
120 -
121118 $link->setParameter( $this->m_params['pagelinktext'], 'pagelinktext' );
122 -
 119+
123120 if ( array_key_exists( 'limit', $this->m_params ) ) {
124121 $link->setParameter( $this->m_params['limit'], 'limit' );
125122 } else { // Use a reasonable default limit.
@@ -126,10 +123,10 @@
127124 }
128125
129126 $this->isHTML = ( $outputmode == SMW_OUTPUT_HTML );
130 -
131 - return $link->getText( $outputmode, $this->mLinker );
 127+
 128+ return $link->getText( $outputmode, $this->mLinker );
132129 }
133 -
 130+
134131 /**
135132 * @see SMWResultPrinter::getMimeType()
136133 */
@@ -139,17 +136,16 @@
140137
141138 /**
142139 * @see SMWResultPrinter::getFileName()
143 - */
 140+ */
144141 public function getFileName( $res ) {
145 - // TODO FIXME
 142+ // @TODO FIXME
146143 return 'kml.kml';
147144 }
148 -
 145+
149146 /**
150147 * @see SMWResultPrinter::getName()
151148 */
152149 public final function getName() {
153150 return wfMsg( 'semanticmaps-kml' );
154151 }
155 -
156152 }