PageRenderTime 27ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/AniMonaco.skin.php

https://gitlab.com/GethN7/monaco-port
PHP | 149 lines | 123 code | 16 blank | 10 comment | 14 complexity | 4bba8b38e0a28cd78daca3404961698e MD5 | raw file
  1. <?php
  2. /**
  3. * AniMonaco skin, a Monaco subskin
  4. *
  5. * @package MediaWiki
  6. * @subpackage Skins
  7. *
  8. * @author Daniel Friesen <http://daniel.friesen.name/>
  9. */
  10. if(!defined('MEDIAWIKI')) {
  11. die(-1);
  12. }
  13. class SkinAniMonaco extends SkinMonaco {
  14. var $skinname = 'animonaco', $stylename = 'animonaco',
  15. $template = 'AniMonacoTemplate';
  16. function setupSkinUserCss( OutputPage $out ){
  17. parent::setupSkinUserCss( $out );
  18. $out->addStyle( 'monaco/style/css/animonaco.css', 'screen' );
  19. }
  20. }
  21. class AniMonacoTemplate extends MonacoTemplate {
  22. // @todo Find a clean way to hook into the user links and put a break after My Talk so that we have one line Username + My Talk and the rest on the next line
  23. function execute() {
  24. global $wgRequest;
  25. if ( function_exists('efInfoboxExtract') ) {
  26. // Extract the infobox if the InfoboxInclude extension is setup
  27. $action = $wgRequest->getText("action", "view");
  28. $isView = $action === "view" || $action === "purge";
  29. if ( $isView ) {
  30. $html = $this->data['bodytext'];
  31. $this->mInfobox = efInfoboxExtract( $html );
  32. $this->data['bodytext'] = $html;
  33. }
  34. }
  35. parent::execute();
  36. }
  37. function printBeforePage() {
  38. global $egAniMonacoLeaderboardCallback;
  39. if ( !$egAniMonacoLeaderboardCallback ) {
  40. return;
  41. }
  42. ob_start();
  43. call_user_func( $egAniMonacoLeaderboardCallback, $this );
  44. $leaderboard = ob_get_contents();
  45. ob_end_clean();
  46. if ( !trim($leaderboard) ) {
  47. return;
  48. }
  49. ?>
  50. <div id="ad_page" class="page">
  51. <?php echo $leaderboard; ?>
  52. </div>
  53. <?php
  54. }
  55. function setupRightSidebar() {
  56. if ( $this->mInfobox )
  57. $this->addToRightSidebar($this->mInfobox);
  58. }
  59. function lateRightSidebar() {
  60. global $egAniMonacoRightSidebarCallback;
  61. if ( !$egAniMonacoRightSidebarCallback ) {
  62. return;
  63. }
  64. ob_start();
  65. call_user_func( $egAniMonacoRightSidebarCallback, $this );
  66. $rsidebar = ob_get_contents();
  67. ob_end_clean();
  68. if ( !trim($rsidebar) ) {
  69. return;
  70. }
  71. $this->sidebarBox(null, $rsidebar, array( "wrapcontents" => false, "class" => "ad_box" ));
  72. }
  73. function printExtraSidebar() {
  74. global $wgTitle, $wgSitename, $egTwitterName, $wgRequest, $egAniMonacoSidebarCallback;
  75. $action = $wgRequest->getText("action", "view");
  76. $isView = $action === "view" || $action === "purge";
  77. if ( $isView && $wgTitle->isContentPage() ) {
  78. $url = $wgTitle->getFullURL();
  79. $eurl = htmlspecialchars($url);
  80. if ( $egAniMonacoSidebarCallback ) {
  81. call_user_func( $egAniMonacoSidebarCallback, $this );
  82. }
  83. if ( $wgTitle->exists() ) {
  84. ?>
  85. <script type="text/javascript">
  86. var reddit_url = "<?php echo Xml::escapeJsString( $url ) ?>";
  87. var reddit_title = "<?php echo Xml::escapeJsString( "{$wgTitle->getPrefixedText()} - $wgSitename" ); ?>";
  88. </script>
  89. <div class="widget sidebox sharebox">
  90. <table border=0 style="width: 100%;">
  91. <tr>
  92. <td></td>
  93. <td><fb:like href="<?php echo $eurl ?>" layout="box_count" width="50" font="arial"></fb:like></td>
  94. <td><a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo $eurl ?>" data-text="<?php echo htmlspecialchars("{$wgTitle->getPrefixedText()} on the $wgSitename"); ?>" data-count="vertical"<?php if ( $egTwitterName ) echo' data-via="'.htmlspecialchars($egTwitterName).'"'; ?>>Tweet</a></script></td>
  95. <td></td>
  96. </tr>
  97. <tr>
  98. <td><a class="DiggThisButton DiggMedium"></a></td>
  99. <td><script type="text/javascript" src="http://reddit.com/static/button/button2.js"></script></td>
  100. <td><a title="Post to Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="<?php echo $eurl ?>"></a></td>
  101. <td><script src="http://www.stumbleupon.com/hostedbadge.php?s=5&r=<?php htmlspecialchars(urlencode($url)) ?>"></script></td>
  102. </tr>
  103. <tr>
  104. <td colspan=4>
  105. <?php $save = "http://www.delicious.com/save?url=".urlencode($url)."&title=".urlencode("{$wgTitle->getPrefixedText()} - $wgSitename"); ?>
  106. <img src="http://l.yimg.com/hr/img/delicious.small.gif" height="10" width="10" alt="Delicious" />
  107. <a href="<?php echo htmlspecialchars($save) ?>" onclick="window.open(this.href+'&v=5&noui&jump=close','delicious','toolbar=no,width=550,height=550'); return false;"> Bookmark this on Delicious</a>
  108. </td>
  109. </table>
  110. </div>
  111. <script type="text/javascript">
  112. (function() {
  113. var srcArray = [
  114. "http://platform.twitter.com/widgets.js",
  115. "http://widgets.digg.com/buttons.js",
  116. "http://connect.facebook.net/en_US/all.js#xfbml=1",
  117. "http://www.google.com/buzz/api/button.js"
  118. ];
  119. var anchor = document.getElementsByTagName('script')[0];
  120. while( srcArray.length ) {
  121. var s = document.createElement('script');
  122. s.type = "text/javascript";
  123. s.async = true;
  124. s.src = srcArray.shift();
  125. anchor.parentNode.insertBefore(s, anchor);
  126. }
  127. })();
  128. </script>
  129. <?php
  130. }
  131. }
  132. }
  133. }