Index: trunk/extensions/MobileFrontend/MobileFormatter.php |
— | — | @@ -70,6 +70,14 @@ |
71 | 71 | |
72 | 72 | private $itemsToRemove = array(); |
73 | 73 | |
| 74 | + /** |
| 75 | + * Constructor |
| 76 | + * |
| 77 | + * @param string $html: Text to process |
| 78 | + * @param Title $title: Title to which $html belongs |
| 79 | + * @param string $format: 'XHTML' or 'WML' |
| 80 | + * @param WmlContext $wmlContext: Context for creation of WML cards, can be omitted if $format == 'XHTML' |
| 81 | + */ |
74 | 82 | public function __construct( $html, $title, $format, WmlContext $wmlContext = null ) { |
75 | 83 | wfProfileIn( __METHOD__ ); |
76 | 84 | |
— | — | @@ -145,8 +153,7 @@ |
146 | 154 | |
147 | 155 | /** |
148 | 156 | * Removes content inappropriate for mobile devices |
149 | | - * @global type $wgMFRemovableClasses |
150 | | - * @param type $removeDefaults |
| 157 | + * @param bool $removeDefaults: Whether default settings at self::$defaultItemsToRemove should be used |
151 | 158 | */ |
152 | 159 | public function filterContent( $removeDefaults = true ) { |
153 | 160 | global $wgMFRemovableClasses; |
— | — | @@ -239,6 +246,14 @@ |
240 | 247 | wfProfileOut( __METHOD__ ); |
241 | 248 | } |
242 | 249 | |
| 250 | + /** |
| 251 | + * Performs final transformations to mobile format and returns resulting HTML/WML |
| 252 | + * |
| 253 | + * @param string|bool $id: ID of element to get HTML from or false to get it from the whole tree |
| 254 | + * @param string $prependHtml: HTML to be prepended to result before final transformations |
| 255 | + * @param string $appendHtml: HTML to be appended to result before final transformations |
| 256 | + * @return string: Processed HTML |
| 257 | + */ |
243 | 258 | public function getText( $id = false, $prependHtml = '', $appendHtml = '' ) { |
244 | 259 | wfProfileIn( __METHOD__ ); |
245 | 260 | if ( $this->mainPage ) { |
— | — | @@ -271,7 +286,8 @@ |
272 | 287 | } |
273 | 288 | |
274 | 289 | /** |
275 | | - * @param $matches array |
| 290 | + * Callback for headingTransform() |
| 291 | + * @param array $matches |
276 | 292 | * @return string |
277 | 293 | */ |
278 | 294 | private function headingTransformCallbackWML( $matches ) { |
— | — | @@ -286,7 +302,8 @@ |
287 | 303 | } |
288 | 304 | |
289 | 305 | /** |
290 | | - * @param $matches array |
| 306 | + * Callback for headingTransform() |
| 307 | + * @param array $matches |
291 | 308 | * @return string |
292 | 309 | */ |
293 | 310 | private function headingTransformCallbackXHTML( $matches ) { |
— | — | @@ -350,8 +367,9 @@ |
351 | 368 | } |
352 | 369 | |
353 | 370 | /** |
354 | | - * @param $s string |
355 | | - * @return string |
| 371 | + * Creates a WML card from input |
| 372 | + * @param string $s: Raw WML |
| 373 | + * @return string: WML card |
356 | 374 | */ |
357 | 375 | protected function createWMLCard( $s ) { |
358 | 376 | wfProfileIn( __METHOD__ ); |
— | — | @@ -406,7 +424,8 @@ |
407 | 425 | } |
408 | 426 | |
409 | 427 | /** |
410 | | - * @param $s string |
| 428 | + * Prepares headings in WML mode, makes sections expandable in XHTML mode |
| 429 | + * @param string $s |
411 | 430 | * @return string |
412 | 431 | */ |
413 | 432 | protected function headingTransform( $s ) { |
— | — | @@ -449,6 +468,7 @@ |
450 | 469 | } |
451 | 470 | |
452 | 471 | /** |
| 472 | + * Transforms CSS selectors into an internal representation suitable for processing |
453 | 473 | * @return array |
454 | 474 | */ |
455 | 475 | private function parseItemsToRemove() { |
— | — | @@ -477,7 +497,8 @@ |
478 | 498 | } |
479 | 499 | |
480 | 500 | /** |
481 | | - * @param DOMDocument $mainPage |
| 501 | + * Performs transformations specific to main page |
| 502 | + * @param DOMDocument $mainPage: Tree to process |
482 | 503 | * @return DOMElement |
483 | 504 | */ |
484 | 505 | protected function parseMainPage( DOMDocument $mainPage ) { |