[Mediawiki-l] how to rewrite hooks for Vector?

jidanni at jidanni.org jidanni at jidanni.org
Fri Jun 4 04:47:36 UTC 2010


Man was I slick when I wrote all this for MonoBook skin in my LocalSettings.php, for my
http://jidanni.org/comp/wiki/article-category.html sites,

  $wgNamespaceProtection[NS_CATEGORY]=$wgNamespaceProtection[NS_CATEGORY_TALK]=array('editinterface');
  function JidanniBlueLinkCategoryPages($linker,$target,&$text,&$customAttribs,&$query,&$options){
    switch($target->mNamespace){case NS_CATEGORY:case NS_CATEGORY_TALK:$options[0]='known';}return true;}
  $wgHooks['LinkBegin'][]='JidanniBlueLinkCategoryPages';
  function JidanniDontInviteEdit(&$article,&$outputDone){if($article->getID()===0){
      switch($article->mTitle->getNamespace()){case NS_CATEGORY:case NS_CATEGORY_TALK:$outputDone=true;}}return true;}
  $wgHooks['ArticleViewHeader'][]='JidanniDontInviteEdit';#Bug 17630
  function JidanniLessRedContentActions($sktemplate,$content_actions){
    if(array_key_exists('talk', $content_actions)&&'new'==$content_actions['talk']['class']&&
       !$sktemplate->mTitle->quickUserCan('createtalk')){unset($content_actions['talk'],$content_actions['watch']);}
    if(array_key_exists('nstab-category',$content_actions)&&'selected new'==$content_actions['nstab-category']['class']){
      $content_actions['nstab-category']['class']='selected';}
    return true;}
  $wgHooks['SkinTemplateTabs'][]='JidanniLessRedContentActions'; #Bug 17963

But now the years have passed and Vector Skin is now the default, and I
need to also make it work for Vector too but of course the moral of the
story is ... grandpa isn't a suitable Ph.D. candidate as he used to be.
So could someone tell me what I need to do to make these work in Vector?
Yes I know some flat list as been replaced by an array... but my brain
has become like a flat list... In the meanwhile my site looks bad by
default. Yes I could change the default skin back to Monobook but sooner
or later I need to rewrite these.



More information about the MediaWiki-l mailing list