Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Table.php |
— | — | @@ -22,10 +22,6 @@ |
23 | 23 | global $smwgIQRunningNumber; |
24 | 24 | SMWOutputs::requireHeadItem(SMW_HEADER_SORTTABLE); |
25 | 25 | |
26 | | - $printrequestparameters = array(); |
27 | | - foreach ($res->getPrintRequests() as $pr) |
28 | | - $printrequestparameters[] = $pr->getParams(); |
29 | | - |
30 | 26 | // print header |
31 | 27 | $result = '<table class="smwtable"' . |
32 | 28 | ('broadtable' == $this->mFormat?' width="100%"':'') . |
— | — | @@ -47,11 +43,9 @@ |
48 | 44 | $fieldcount = $fieldcount + 1; |
49 | 45 | |
50 | 46 | $result .= "\t\t<td"; |
51 | | - if (array_key_exists('align', $printrequestparameters[$fieldcount])) { |
52 | | - $alignment = $printrequestparameters[$fieldcount]['align']; |
53 | | - // check the content, otherwise evil people could inject here anything they wanted |
54 | | - if (($alignment == 'right') || ($alignment == 'left')) |
55 | | - $result .= " style=\"text-align:" . $printrequestparameters[$fieldcount]['align'] . ";\""; |
| 47 | + $alignment = trim($field->getPrintRequest()->getParameter('align')); |
| 48 | + if (($alignment == 'right') || ($alignment == 'left') || ($alignment == 'center')) { |
| 49 | + $result .= ' style="text-align:' . $alignment . ';"'; |
56 | 50 | } |
57 | 51 | $result .= ">"; |
58 | 52 | |
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_PrintRequest.php |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | protected $m_outputformat; // output format string for formatting results, if applicable |
31 | 31 | protected $m_hash = false; // cache your hash (currently useful since SMWQueryResult accesses the hash many times, might be dropped at some point) |
32 | 32 | protected $m_params = array(); |
33 | | - |
| 33 | + |
34 | 34 | /** |
35 | 35 | * Create a print request. |
36 | 36 | * @param $mode a constant defining what to printout |
— | — | @@ -201,40 +201,28 @@ |
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
205 | | - * Returns the value of a named parameter. |
| 205 | + * Returns the value of a named parameter. |
206 | 206 | * @param $key string the name of the parameter key |
207 | | - * @return string Value of the paramer, if set (else '') |
| 207 | + * @return string Value of the paramer, if set (else FALSE) |
208 | 208 | */ |
209 | | - public function getParam($key) { |
210 | | - if (array_key_exists($key, $this->m_params)) |
211 | | - return $this->m_params[$key]; |
212 | | - else |
213 | | - return ''; |
| 209 | + public function getParameter($key) { |
| 210 | + return (array_key_exists($key, $this->m_params))?$this->m_params[$key]:false; |
214 | 211 | } |
215 | 212 | |
216 | 213 | /** |
217 | | - * Returns if a named parameter is set. |
218 | | - * @param $key string the name of the parameter |
219 | | - * @return boolean True if the parameter is set, false otherwise |
220 | | - */ |
221 | | - public function hasParam($key) { |
222 | | - return array_key_exists($key, $this->m_params); |
223 | | - } |
224 | | - |
225 | | - /** |
226 | | - * Returns the array of parameters, where a string is mapped to a string. |
| 214 | + * Returns the array of parameters, where a string is mapped to a string. |
227 | 215 | * @return array Map of parameter names to values. |
228 | 216 | */ |
229 | | - public function getParams() { |
| 217 | + public function getParameters() { |
230 | 218 | return $this->m_params; |
231 | 219 | } |
232 | | - |
| 220 | + |
233 | 221 | /** |
234 | 222 | * Sets a print request parameter. |
235 | 223 | * @param $key string Name of the parameter |
236 | | - * @param $value string Value for the parameter |
| 224 | + * @param $value string Value for the parameter |
237 | 225 | */ |
238 | | - public function setParam($key, $value) { |
| 226 | + public function setParameter($key, $value) { |
239 | 227 | $this->m_params[$key] = $value; |
240 | 228 | } |
241 | 229 | } |
\ No newline at end of file |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php |
— | — | @@ -229,10 +229,10 @@ |
230 | 230 | $lastprintout = new SMWPrintRequest($printmode, $label, $data, trim($propparts[1])); |
231 | 231 | $printouts[] = $lastprintout; |
232 | 232 | } elseif ($param[0] == '+') { // print request parameter |
233 | | - if ($lastprintout != NULL) { |
| 233 | + if ($lastprintout !== NULL) { |
234 | 234 | $param = substr($param,1); |
235 | 235 | $parts = explode('=',$param,2); |
236 | | - $lastprintout->setParam($parts[0], $parts[1]); |
| 236 | + if (count($parts) == 2) $lastprintout->setParameter(trim($parts[0]), $parts[1]); |
237 | 237 | } |
238 | 238 | } else { // parameter or query |
239 | 239 | $parts = explode('=',$param,2); |
— | — | @@ -314,14 +314,14 @@ |
315 | 315 | */ |
316 | 316 | static protected function getResultFormat($params) { |
317 | 317 | global $smwgResultAliases; |
318 | | - |
| 318 | + |
319 | 319 | $format = 'auto'; |
320 | 320 | if (array_key_exists('format', $params)) { |
321 | 321 | $format = strtolower(trim($params['format'])); |
322 | 322 | global $smwgResultFormats; |
323 | 323 | |
324 | 324 | if ( !array_key_exists($format, $smwgResultFormats) ) { |
325 | | - |
| 325 | + |
326 | 326 | foreach($smwgResultAliases as $mainFormat => $aliases) { |
327 | 327 | if (in_array($format, $aliases)) { |
328 | 328 | $format = $mainFormat; |
— | — | @@ -329,7 +329,7 @@ |
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | } |
333 | | - |
| 333 | + |
334 | 334 | if (! $isAlias) $format = 'auto'; // If it is an unknown format, defaults to list/table again |
335 | 335 | } |
336 | 336 | } |