r65824 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65823‎ | r65824 | r65825 >
Date:02:28, 3 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6 - refactored passing of the parser object
Modified paths:
  • /trunk/extensions/Maps/Features/DisplayMap/Maps_BaseMap.php (modified) (history)
  • /trunk/extensions/Maps/Features/DisplayPoint/Maps_BasePointMap.php (modified) (history)
  • /trunk/extensions/Maps/Features/Maps_iMapParserFunction.php (modified) (history)
  • /trunk/extensions/Maps/Services/GoogleMaps/Maps_GoogleMapsDispMap.php (modified) (history)
  • /trunk/extensions/Maps/Services/GoogleMaps/Maps_GoogleMapsDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/Services/GoogleMaps3/Maps_GoogleMaps3DispMap.php (modified) (history)
  • /trunk/extensions/Maps/Services/GoogleMaps3/Maps_GoogleMaps3DispPoint.php (modified) (history)
  • /trunk/extensions/Maps/Services/OpenLayers/Maps_OpenLayersDispMap.php (modified) (history)
  • /trunk/extensions/Maps/Services/OpenLayers/Maps_OpenLayersDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/Services/YahooMaps/Maps_YahooMapsDispMap.php (modified) (history)
  • /trunk/extensions/Maps/Services/YahooMaps/Maps_YahooMapsDispPoint.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Services/GoogleMaps3/Maps_GoogleMaps3DispPoint.php
@@ -48,7 +48,7 @@
4949 * @see MapsBaseMap::addSpecificMapHTML()
5050 *
5151 */
52 - public function addSpecificMapHTML( Parser $parser ) {
 52+ public function addSpecificMapHTML() {
5353 global $egMapsGMaps3Prefix, $egGMaps3OnThisPage;
5454
5555 $mapName = $egMapsGMaps3Prefix . '_' . $egGMaps3OnThisPage;
@@ -63,7 +63,7 @@
6464 null
6565 );
6666
67 - $parser->getOutput()->addHeadItem(
 67+ $this->parser->getOutput()->addHeadItem(
6868 Html::inlineScript( <<<EOT
6969 addOnloadHook(
7070 function() {
Index: trunk/extensions/Maps/Services/GoogleMaps3/Maps_GoogleMaps3DispMap.php
@@ -46,7 +46,7 @@
4747 * @see MapsBaseMap::addSpecificMapHTML()
4848 *
4949 */
50 - public function addSpecificMapHTML( Parser $parser ) {
 50+ public function addSpecificMapHTML() {
5151 global $egMapsGMaps3Prefix, $egGMaps3OnThisPage;
5252
5353 $mapName = $egMapsGMaps3Prefix . '_' . $egGMaps3OnThisPage;
@@ -60,7 +60,7 @@
6161 null
6262 );
6363
64 - $parser->getOutput()->addHeadItem(
 64+ $this->parser->getOutput()->addHeadItem(
6565 Html::inlineScript( <<<EOT
6666 addOnloadHook(
6767 function() {
Index: trunk/extensions/Maps/Services/YahooMaps/Maps_YahooMapsDispPoint.php
@@ -46,7 +46,7 @@
4747 * @see MapsBaseMap::addSpecificMapHTML()
4848 *
4949 */
50 - public function addSpecificMapHTML( Parser $parser ) {
 50+ public function addSpecificMapHTML() {
5151 global $egMapsYahooMapsPrefix, $egYahooMapsOnThisPage;
5252
5353 $mapName = $egMapsYahooMapsPrefix . '_' . $egYahooMapsOnThisPage;
@@ -60,7 +60,7 @@
6161 wfMsg( 'maps-loading-map' )
6262 );
6363
64 - $parser->getOutput()->addHeadItem(
 64+ $this->parser->getOutput()->addHeadItem(
6565 Html::inlineScript( <<<EOT
6666 addOnloadHook(
6767 function() {
Index: trunk/extensions/Maps/Services/YahooMaps/Maps_YahooMapsDispMap.php
@@ -37,7 +37,7 @@
3838 /**
3939 * @see MapsBaseMap::addSpecificMapHTML()
4040 */
41 - public function addSpecificMapHTML( Parser $parser ) {
 41+ public function addSpecificMapHTML() {
4242 global $egMapsYahooMapsPrefix, $egYahooMapsOnThisPage;
4343
4444 $mapName = $egMapsYahooMapsPrefix . '_' . $egYahooMapsOnThisPage;
@@ -51,7 +51,7 @@
5252 wfMsg( 'maps-loading-map' )
5353 );
5454
55 - $parser->getOutput()->addHeadItem(
 55+ $this->parser->getOutput()->addHeadItem(
5656 Html::inlineScript( <<<EOT
5757 addOnloadHook(
5858 function() {
Index: trunk/extensions/Maps/Services/OpenLayers/Maps_OpenLayersDispPoint.php
@@ -46,7 +46,7 @@
4747 * @see MapsBaseMap::addSpecificMapHTML()
4848 *
4949 */
50 - public function addSpecificMapHTML( Parser $parser ) {
 50+ public function addSpecificMapHTML() {
5151 global $egMapsOpenLayersPrefix, $egOpenLayersOnThisPage;
5252
5353 $layerItems = MapsOpenLayers::createLayersStringAndLoadDependencies( $this->output, $this->layers );
@@ -62,7 +62,7 @@
6363 wfMsg( 'maps-loading-map' )
6464 );
6565
66 - $parser->getOutput()->addHeadItem(
 66+ $this->parser->getOutput()->addHeadItem(
6767 Html::inlineScript( <<<EOT
6868 addOnloadHook(
6969 function() {
Index: trunk/extensions/Maps/Services/OpenLayers/Maps_OpenLayersDispMap.php
@@ -37,7 +37,7 @@
3838 /**
3939 * @see MapsBaseMap::addSpecificMapHTML()
4040 */
41 - public function addSpecificMapHTML( Parser $parser ) {
 41+ public function addSpecificMapHTML() {
4242 global $egMapsOpenLayersPrefix, $egOpenLayersOnThisPage;
4343
4444 $layerItems = MapsOpenLayers::createLayersStringAndLoadDependencies( $this->output, $this->layers );
@@ -53,7 +53,7 @@
5454 wfMsg( 'maps-loading-map' )
5555 );
5656
57 - $parser->getOutput()->addHeadItem(
 57+ $this->parser->getOutput()->addHeadItem(
5858 Html::inlineScript( <<<EOT
5959 addOnloadHook(
6060 function() {
Index: trunk/extensions/Maps/Services/GoogleMaps/Maps_GoogleMapsDispMap.php
@@ -58,7 +58,7 @@
5959 /**
6060 * @see MapsBaseMap::addSpecificMapHTML()
6161 */
62 - public function addSpecificMapHTML( Parser $parser ) {
 62+ public function addSpecificMapHTML() {
6363 global $egMapsGoogleMapsPrefix, $egGoogleMapsOnThisPage;
6464
6565 $mapName = $egMapsGoogleMapsPrefix . '_' . $egGoogleMapsOnThisPage;
@@ -74,7 +74,7 @@
7575 wfMsg( 'maps-loading-map' )
7676 );
7777
78 - $parser->getOutput()->addHeadItem(
 78+ $this->parser->getOutput()->addHeadItem(
7979 Html::inlineScript( <<<EOT
8080 addOnloadHook(
8181 function() {
Index: trunk/extensions/Maps/Services/GoogleMaps/Maps_GoogleMapsDispPoint.php
@@ -61,7 +61,7 @@
6262 /**
6363 * @see MapsBaseMap::addSpecificMapHTML()
6464 */
65 - public function addSpecificMapHTML( Parser $parser ) {
 65+ public function addSpecificMapHTML() {
6666 global $egMapsGoogleMapsPrefix, $egGoogleMapsOnThisPage;
6767
6868 $mapName = $egMapsGoogleMapsPrefix . '_' . $egGoogleMapsOnThisPage;
@@ -77,7 +77,7 @@
7878 wfMsg( 'maps-loading-map' )
7979 );
8080
81 - $parser->getOutput()->addHeadItem(
 81+ $this->parser->getOutput()->addHeadItem(
8282 Html::inlineScript(
8383 <<<EOT
8484 addOnloadHook(
Index: trunk/extensions/Maps/Features/DisplayPoint/Maps_BasePointMap.php
@@ -106,13 +106,15 @@
107107 * @return html
108108 */
109109 public final function getMapHtml( Parser &$parser, array $params ) {
 110+ $this->parser = $parser;
 111+
110112 $this->featureParameters = MapsDisplayPoint::$parameters;
111113
112114 $this->doMapServiceLoad();
113115
114116 $this->setMapProperties( $params );
115117
116 - $this->setMarkerData( $parser );
 118+ $this->setMarkerData();
117119
118120 $this->createMarkerString();
119121
@@ -122,19 +124,17 @@
123125 $this->zoom = $this->getDefaultZoom();
124126 }
125127
126 - $this->addSpecificMapHTML( $parser );
 128+ $this->addSpecificMapHTML();
127129
128130 return $this->output;
129131 }
130132
131133 /**
132134 * Fills the $markerData array with the locations and their meta data.
133 - *
134 - * @param unknown_type $parser
135135 */
136 - private function setMarkerData( $parser ) {
137 - $this->title = Xml::escapeJsString( $parser->recursiveTagParse( $this->title ) );
138 - $this->label = Xml::escapeJsString( $parser->recursiveTagParse( $this->label ) );
 136+ private function setMarkerData() {
 137+ $this->title = Xml::escapeJsString( $this->parser->recursiveTagParse( $this->title ) );
 138+ $this->label = Xml::escapeJsString( $this->parser->recursiveTagParse( $this->label ) );
139139
140140 foreach ( $this->coordinates as $coordinates ) {
141141 $args = explode( '~', $coordinates );
@@ -145,11 +145,11 @@
146146
147147 if ( count( $args ) > 1 ) {
148148 // Parse and add the point specific title if it's present.
149 - $markerData['title'] = $parser->recursiveTagParse( $args[1] );
 149+ $markerData['title'] = $this->parser->recursiveTagParse( $args[1] );
150150
151151 if ( count( $args ) > 2 ) {
152152 // Parse and add the point specific label if it's present.
153 - $markerData['label'] = $parser->recursiveTagParse( $args[2] );
 153+ $markerData['label'] = $this->parser->recursiveTagParse( $args[2] );
154154
155155 if ( count( $args ) > 3 ) {
156156 // Add the point specific icon if it's present.
Index: trunk/extensions/Maps/Features/Maps_iMapParserFunction.php
@@ -31,6 +31,6 @@
3232 /**
3333 * Adds the HTML specific to the mapping service to the output.
3434 */
35 - function addSpecificMapHTML( Parser $parser );
 35+ function addSpecificMapHTML();
3636 }
3737
Index: trunk/extensions/Maps/Features/DisplayMap/Maps_BaseMap.php
@@ -30,6 +30,8 @@
3131
3232 protected $output = '';
3333
 34+ protected $parser;
 35+
3436 protected $spesificParameters = false;
3537 protected $featureParameters = false;
3638
@@ -88,6 +90,8 @@
8991 * @return html
9092 */
9193 public final function getMapHtml( Parser &$parser, array $params ) {
 94+ $this->parser = $parser;
 95+
9296 $this->featureParameters = MapsDisplayMap::$parameters;
9397
9498 $this->doMapServiceLoad();
@@ -100,7 +104,7 @@
101105 $this->zoom = $this->getDefaultZoom();
102106 }
103107
104 - $this->addSpecificMapHTML( $parser );
 108+ $this->addSpecificMapHTML();
105109
106110 return $this->output;
107111 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r65827Follow up to r65824jeroendedauw03:08, 3 May 2010

Status & tagging log