1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- use strict;
- use v5.10;
- our (%Page, %IndexHash, %AdminPages, $HomePage, $RCName, @MyInitVariables, $LinkPattern, $FreeLinkPattern, $FullUrlPattern, $InterLinkPattern, $UserGotoBar, @UserGotoBarPages);
- AddModuleDescription('gotobar.pl', 'Gotobar Extension');
- our ($GotobarName);
- $GotobarName = 'GotoBar';
- our ($GotobarSetHome, $GotobarSetRC);
- push(@MyInitVariables, \&GotobarInit);
- sub GotobarInit {
- $GotobarName = FreeToNormal($GotobarName);
- $AdminPages{$GotobarName} = 1;
- if ($IndexHash{$GotobarName}) {
- OpenPage($GotobarName);
- return if PageMarkedForDeletion();
-
-
- @UserGotoBarPages = ();
- $UserGotoBar = '';
- my $count = 0;
- while ($Page{text} =~ m/($LinkPattern|\[\[$FreeLinkPattern\]\]|\[\[$FreeLinkPattern\|([^\]]+)\]\]|\[$InterLinkPattern\s+([^\]]+?)\]|\[$FullUrlPattern[|[:space:]]([^\]]+?)\])/g) {
- my $page = $2||$3||$4||$6||$8;
- my $text = $5||$7||$9;
- $UserGotoBar .= ' ' if $UserGotoBar;
- if ($6) {
- $UserGotoBar .= GetInterLink($page, $text);
- } elsif ($8) {
- $UserGotoBar .= GetUrl($page, $text);
- } else {
- $UserGotoBar .= GetPageLink($page, $text);
-
-
- $count++;
- if ($count == 1) {
- unless ($GotobarSetHome) {$HomePage = FreeToNormal($page)};
- } elsif ($count == 2) {
- unless ($GotobarSetRC) {$RCName = FreeToNormal($page);}
- }
- }
- }
- }
- }
|