* Support for per-page CSS by an extension using wgHooks
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Tue, 27 Sep 2005 19:40:14 +0000 (19:40 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Tue, 27 Sep 2005 19:40:14 +0000 (19:40 +0000)
includes/SkinTemplate.php
skins/MonoBook.php

index 9430aee..d2b054a 100644 (file)
@@ -251,6 +251,7 @@ class SkinTemplate extends Skin {
                $tpl->setRef( 'username', $this->username );
                $tpl->setRef( 'userpage', $this->userpage);
                $tpl->setRef( 'userpageurl', $this->userpageUrlDetails['href']);
+               $tpl->setRef( 'pagecss', $this->setupPageCss() );
                $tpl->setRef( 'usercss', $this->usercss);
                $tpl->setRef( 'userjs', $this->userjs);
                $tpl->setRef( 'userjsprev', $this->userjsprev);
@@ -936,6 +937,21 @@ class SkinTemplate extends Skin {
                wfProfileOut( $fname );
        }
 
+       /**
+        * Code for extensions to hook into to provide per-page CSS, see
+        * extension/PageCSS/PageCSS.php for an implementation of this.
+        *
+        * @access private
+        */
+       function setupPageCss() {
+               $fname = 'SkinTemplate::setupPageCss';
+               wfProfileIn( $fname );
+               $out = false;
+               wfRunHooks( 'SkinTemplateSetupPageCss', array( &$out ) );
+               wfProfileOut( $fname );
+               return $out;
+       }
+
        /**
         * returns css with user-specific options
         * @access public
index 7db1aa4..46c7e99 100644 (file)
@@ -65,6 +65,7 @@ class MonoBookTemplate extends QuickTemplate {
     <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
     <?php if($this->data['jsvarurl'  ]) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl'  ) ?>"></script><?php } ?>
     <script type="<?php $this->text('jsmimetype') ?>" src="<?php                                   $this->text('stylepath' ) ?>/common/wikibits.js"></script>
+    <?php if($this->data['pagecss'   ]) { ?><style type="text/css"><?php              $this->html('pagecss'   ) ?></style><?php    } ?>
     <?php if($this->data['usercss'   ]) { ?><style type="text/css"><?php              $this->html('usercss'   ) ?></style><?php    } ?>
     <?php if($this->data['userjs'    ]) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs'    ) ?>"></script><?php } ?>
     <?php if($this->data['userjsprev']) { ?><script type="<?php $this->text('jsmimetype') ?>"><?php      $this->html('userjsprev') ?></script><?php   } ?>