r89053 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89052‎ | r89053 | r89054 >
Date:18:30, 28 May 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r89050
Modified paths:
  • /trunk/extensions/Spark/Spark.class.php (modified) (history)
  • /trunk/extensions/Spark/Spark.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Spark/Spark.i18n.php
@@ -19,6 +19,7 @@
2020 */
2121 $messages['en'] = array(
2222 'spark-desc' => 'Adds a <code><nowiki><spark /></nowiki></code> tag that enables embedding [http://km.aifb.kit.edu/sites/spark/ Spark] mash-ups.',
 23+ 'spark-missing-query' => 'You need to specify a query using the "data-spark-query" parameter.',
2324 );
2425
2526 /** Message documentation (Message documentation)
Index: trunk/extensions/Spark/Spark.class.php
@@ -44,11 +44,18 @@
4545 * @return string
4646 */
4747 public function render() {
48 - return Html::element(
49 - 'div',
50 - array_merge( array( 'class' => 'spark' ), $this->parameters ),
51 - $this->contents
52 - );
 48+ if ( array_key_exists( 'data-spark-query', $this->parameters ) ) {
 49+ $query = htmlspecialchars( $this->parameters['data-spark-query'] );
 50+ $query = str_replace( array( '&lt;', '&gt;' ), array( '<', '>' ), $query );
 51+ unset( $this->parameters['data-spark-query'] );
 52+
 53+ return '<nowiki><div class="spark" data-spark-query="' . $query . '" ' . Html::expandAttributes( $this->parameters ) . ' >' .
 54+ ( is_null( $this->contents ) ? '' : htmlspecialchars( $this->contents ) ) .
 55+ '</div></nowiki>';
 56+ }
 57+ else {
 58+ return Html::element( 'i', array(), wfMsg( 'spark-missing-query' ) );
 59+ }
5360 }
5461
5562 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r89050work on spark tagjeroendedauw17:52, 28 May 2011

Status & tagging log