Index: trunk/phase3/skins/MonoBook.php |
— | — | @@ -121,6 +121,7 @@ |
122 | 122 | <?php $this->html('bodytext') ?> |
123 | 123 | <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?> |
124 | 124 | <!-- end content --> |
| 125 | + <?php if($this->data['dataAfterContent']) { $this->html ('dataAfterContent'); } ?> |
125 | 126 | <div class="visualClear"></div> |
126 | 127 | </div> |
127 | 128 | </div> |
Index: trunk/phase3/skins/Modern.php |
— | — | @@ -156,6 +156,7 @@ |
157 | 157 | <?php $this->html('bodytext') ?> |
158 | 158 | <div class='mw_clear'></div> |
159 | 159 | <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?> |
| 160 | + <?php $this->html ('dataAfterContent') ?> |
160 | 161 | </div><!-- mw_contentholder --> |
161 | 162 | </div><!-- mw_content --> |
162 | 163 | </div><!-- mw_contentwrapper --> |
Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -1078,6 +1078,12 @@ |
1079 | 1079 | &$text: bottomScripts Text |
1080 | 1080 | Append to $text to add additional text/scripts after the stock bottom scripts. |
1081 | 1081 | |
| 1082 | +'SkinAfterContent': Allows extensions to add text after the page content and |
| 1083 | +article metadata. |
| 1084 | +&$data: (string) Text to be printed out directly (without parsing) |
| 1085 | +This hook should work in all skins. Just set the &$data variable to the text |
| 1086 | +you're going to add. |
| 1087 | + |
1082 | 1088 | 'SkinBuildSidebar': At the end of Skin::buildSidebar() |
1083 | 1089 | $skin: Skin object |
1084 | 1090 | &$bar: Sidebar contents |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -455,6 +455,10 @@ |
456 | 456 | wfDebug( __METHOD__ . ': Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!' ); |
457 | 457 | } |
458 | 458 | |
| 459 | + // allow extensions adding stuff after the page content. |
| 460 | + // See Skin::afterContentHook() for further documentation. |
| 461 | + $tpl->set ('dataAfterContent', $this->afterContentHook()); |
| 462 | + |
459 | 463 | // execute template |
460 | 464 | wfProfileIn( __METHOD__."-execute" ); |
461 | 465 | $res = $tpl->execute(); |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -282,6 +282,9 @@ |
283 | 283 | |
284 | 284 | $out->out( $out->mBodytext . "\n" ); |
285 | 285 | |
| 286 | + // See self::afterContentHook() for documentation |
| 287 | + $out->out ($this->afterContentHook()); |
| 288 | + |
286 | 289 | $out->out( $this->afterContent() ); |
287 | 290 | |
288 | 291 | $out->out( $this->bottomScripts() ); |
— | — | @@ -753,6 +756,43 @@ |
754 | 757 | } |
755 | 758 | |
756 | 759 | /** |
| 760 | + * This runs a hook to allow extensions placing their stuff after content |
| 761 | + * and article metadata (e.g. categories). |
| 762 | + * Note: This function has nothing to do with afterContent(). |
| 763 | + * |
| 764 | + * This hook is placed here in order to allow using the same hook for all |
| 765 | + * skins, both the SkinTemplate based ones and the older ones, which directly |
| 766 | + * use this class to get their data. |
| 767 | + * |
| 768 | + * The output of this function gets processed in SkinTemplate::outputPage() for |
| 769 | + * the SkinTemplate based skins, all other skins should directly echo it. |
| 770 | + * |
| 771 | + * Returns an empty string by default, if not changed by any hook function. |
| 772 | + */ |
| 773 | + protected function afterContentHook () { |
| 774 | + $data = ""; |
| 775 | + |
| 776 | + if (wfRunHooks ('SkinAfterContent', array (&$data))) { |
| 777 | + // adding just some spaces shouldn't toggle the output |
| 778 | + // of the whole <div/>, so we use trim() here |
| 779 | + if (trim ($data) != "") { |
| 780 | + // Doing this here instead of in the skins to |
| 781 | + // ensure that the div has the same ID in all |
| 782 | + // skins |
| 783 | + $data = "<!-- begin SkinAfterContent hook -->\n" . |
| 784 | + "<div id='mw-data-after-content'>\n" . |
| 785 | + "\t$data\n" . |
| 786 | + "</div>\n" . |
| 787 | + "<!-- end SkinAfterContent hook -->\n"; |
| 788 | + } |
| 789 | + } else { |
| 790 | + wfDebug ('Hook SkinAfterContent changed output processing.'); |
| 791 | + } |
| 792 | + |
| 793 | + return $data; |
| 794 | + } |
| 795 | + |
| 796 | + /** |
757 | 797 | * This gets called shortly before the \</body\> tag. |
758 | 798 | * @return String HTML to be put before \</body\> |
759 | 799 | */ |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -58,6 +58,9 @@ |
59 | 59 | * (bug 14921) Special:Contributions/: add user name to <title> |
60 | 60 | Patch by Emufarmers |
61 | 61 | * Unescape more "safe" characters when producing URLs, for added prettiness |
| 62 | +* Introduced a new hook 'SkinAfterContent' that allows extensions to add text |
| 63 | + after the page content and article metadata. Updated all skins and skin |
| 64 | + templates to work with that hook. |
62 | 65 | |
63 | 66 | === Bug fixes in 1.14 === |
64 | 67 | |