Index: trunk/extensions/Spark/Spark.i18n.php |
— | — | @@ -19,6 +19,7 @@ |
20 | 20 | */ |
21 | 21 | $messages['en'] = array( |
22 | 22 | '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.', |
23 | 24 | ); |
24 | 25 | |
25 | 26 | /** Message documentation (Message documentation) |
Index: trunk/extensions/Spark/Spark.class.php |
— | — | @@ -44,11 +44,18 @@ |
45 | 45 | * @return string |
46 | 46 | */ |
47 | 47 | 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( '<', '>' ), 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 | + } |
53 | 60 | } |
54 | 61 | |
55 | 62 | /** |