Adding AdSense to MediaWiki (MonoBook)

From Wiki
Jump to navigationJump to search

MediaWiki version 1.13.3

This is based on MediaWiki version 1.13.3

Here is the diff code generated on /skins/MonoBook.php :

--- MonoBook.php.original 2009-02-01 09:06:44.000000000 -0500
+++ MonoBook.php 2009-02-01 10:09:37.000000000 -0500
@@ -187,10 +187,33 @@
     }
 ?>
     </div><!-- end of the left (by default at least) column -->
        <div class="visualClear"></div>
        <div id="footer">
+<!-- Start of Google AdSense code -->
+<?php if ($this->data['notspecialpage']) {
+  global $wgUser;
+  if ($wgUser->mName != "INSERT MEDIAWIKI USERNAME HERE") {?>
+    <script type="text/javascript"><!--
+      google_ad_client = "pub-XXXXXXXXXXXXXXXX";
+      google_ad_slot = "SLOT #";
+      google_ad_width = 728;
+      google_ad_height = 15;
+      google_ad_format = "728x15_0ads_al";
+      google_ad_channel ="4401045590";
+      google_color_border = "FABD23";
+      google_color_bg = "FFF5F6";
+      google_color_link = "002BB8";
+      google_color_url = "43A642";
+      google_color_text = "6F6F6F";
+      //-->
+    </script>
+    <script type="text/javascript"
+             src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+    </script>
+  <?php } } ?>
+<!-- End of Google AdSense code -->
 <?php
     if($this->data['poweredbyico']) { ?>
         <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div>
 <?php  }
     if($this->data['copyrightico']) { ?>
@@ -300,10 +323,38 @@
     wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
 ?>
        </ul>
     </div>
   </div>
+<!-- Start of Google AdSense code -->
+<?php if ($this->data['notspecialpage']) {
+  global $wgUser;
+  if ($wgUser->mName != "INSERT MEDIAWIKI USERNAME HERE") {?>
+    <div class="portlet">
+      <h5>related</h5>
+      <div class="pBody">
+        <script type="text/javascript"><!--
+          google_ad_client = "pub-XXXXXXXXXXXXXXXX";
+          google_ad_slot = "SLOT #";
+          google_ad_width = 120;
+          google_ad_height = 240;
+          google_ad_format = "120x240_as";
+          google_ad_type = "text_image";
+          google_color_border = "FFFFFF";
+          google_color_bg = "FFFFFF";
+          google_color_link = "485BD0";
+          google_color_text = "000000";
+          google_color_url = "485BD0";
+          //-->
+        </script>
+        <script type="text/javascript"
+                 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+        </script>
+      </div>
+    </div>
+  <?php } } ?>
+<!-- End of Google AdSense code -->
 <?php
   }
 
   /*************************************************************************************************/
   function languageBox() {