コード例 #1
0
/**
 * Creates the options panel.
 * @param $defaults
 * @param $nondefaults
 */
function rcOptionsPanel($defaults, $nondefaults)
{
    global $wgLang, $wgUseRCPatrol;
    $options = $nondefaults + $defaults;
    if ($options['from']) {
        $note = wfMsgExt('rcnotefrom', array('parseinline'), $wgLang->formatNum($options['limit']), $wgLang->timeanddate($options['from'], true));
    } else {
        $note = wfMsgExt('rcnote', array('parseinline'), $wgLang->formatNum($options['limit']), $wgLang->formatNum($options['days']), $wgLang->timeAndDate(wfTimestampNow(), true));
    }
    // limit links
    $options_limit = array(50, 100, 250, 500);
    foreach ($options_limit as $value) {
        $cl[] = makeOptionsLink($wgLang->formatNum($value), array('limit' => $value), $nondefaults);
    }
    $cl = implode(' | ', $cl);
    // day links, reset 'from' to none
    $options_days = array(1, 3, 7, 14, 30);
    foreach ($options_days as $value) {
        $dl[] = makeOptionsLink($wgLang->formatNum($value), array('days' => $value, 'from' => ''), $nondefaults);
    }
    $dl = implode(' | ', $dl);
    // show/hide links
    $showhide = array(wfMsg('show'), wfMsg('hide'));
    $minorLink = makeOptionsLink($showhide[1 - $options['hideminor']], array('hideminor' => 1 - $options['hideminor']), $nondefaults);
    $botLink = makeOptionsLink($showhide[1 - $options['hidebots']], array('hidebots' => 1 - $options['hidebots']), $nondefaults);
    $anonsLink = makeOptionsLink($showhide[1 - $options['hideanons']], array('hideanons' => 1 - $options['hideanons']), $nondefaults);
    $liuLink = makeOptionsLink($showhide[1 - $options['hideliu']], array('hideliu' => 1 - $options['hideliu']), $nondefaults);
    $patrLink = makeOptionsLink($showhide[1 - $options['hidepatrolled']], array('hidepatrolled' => 1 - $options['hidepatrolled']), $nondefaults);
    $myselfLink = makeOptionsLink($showhide[1 - $options['hidemyself']], array('hidemyself' => 1 - $options['hidemyself']), $nondefaults);
    $links[] = wfMsgHtml('rcshowhideminor', $minorLink);
    $links[] = wfMsgHtml('rcshowhidebots', $botLink);
    $links[] = wfMsgHtml('rcshowhideanons', $anonsLink);
    $links[] = wfMsgHtml('rcshowhideliu', $liuLink);
    if ($wgUseRCPatrol) {
        $links[] = wfMsgHtml('rcshowhidepatr', $patrLink);
    }
    $links[] = wfMsgHtml('rcshowhidemine', $myselfLink);
    $hl = implode(' | ', $links);
    // show from this onward link
    $now = $wgLang->timeanddate(wfTimestampNow(), true);
    $tl = makeOptionsLink($now, array('from' => wfTimestampNow()), $nondefaults);
    $rclinks = wfMsgExt('rclinks', array('parseinline', 'replaceafter'), $cl, $dl, $hl);
    $rclistfrom = wfMsgExt('rclistfrom', array('parseinline', 'replaceafter'), $tl);
    return "{$note}<br />{$rclinks}<br />{$rclistfrom}";
}
コード例 #2
0
/**
 * Creates the options panel
 */
function rcOptionsPanel($defaults, $nondefaults)
{
    global $wgLang;
    $options = $nondefaults + $defaults;
    if ($options['from']) {
        $note = wfMsg('rcnotefrom', $wgLang->formatNum($options['limit']), $wgLang->timeanddate($options['from'], true));
    } else {
        $note = wfMsg('rcnote', $wgLang->formatNum($options['limit']), $wgLang->formatNum($options['days']));
    }
    // limit links
    $cl = '';
    $options_limit = array(50, 100, 250, 500);
    $i = 0;
    while ($i + 1 < count($options_limit)) {
        $cl .= makeOptionsLink($options_limit[$i], array('limit' => $options_limit[$i]), $nondefaults) . ' | ';
        $i++;
    }
    $cl .= makeOptionsLink($options_limit[$i], array('limit' => $options_limit[$i]), $nondefaults);
    // day links, reset 'from' to none
    $dl = '';
    $options_days = array(1, 3, 7, 14, 30);
    $i = 0;
    while ($i + 1 < count($options_days)) {
        $dl .= makeOptionsLink($options_days[$i], array('days' => $options_days[$i], 'from' => ''), $nondefaults) . ' | ';
        $i++;
    }
    $dl .= makeOptionsLink($options_days[$i], array('days' => $options_days[$i], 'from' => ''), $nondefaults);
    // show/hide links
    $showhide = array(wfMsg('show'), wfMsg('hide'));
    $minorLink = makeOptionsLink($showhide[1 - $options['hideminor']], array('hideminor' => 1 - $options['hideminor']), $nondefaults);
    $botLink = makeOptionsLink($showhide[1 - $options['hidebots']], array('hidebots' => 1 - $options['hidebots']), $nondefaults);
    $liuLink = makeOptionsLink($showhide[1 - $options['hideliu']], array('hideliu' => 1 - $options['hideliu']), $nondefaults);
    $patrLink = makeOptionsLink($showhide[1 - $options['hidepatrolled']], array('hidepatrolled' => 1 - $options['hidepatrolled']), $nondefaults);
    $hl = wfMsg('showhideminor', $minorLink, $botLink, $liuLink, $patrLink);
    // show from this onward link
    $now = $wgLang->timeanddate(wfTimestampNow(), true);
    $tl = makeOptionsLink($now, array('from' => wfTimestampNow()), $nondefaults);
    $rclinks = wfMsg('rclinks', $cl, $dl, $hl);
    $rclistfrom = wfMsg('rclistfrom', $tl);
    return "{$note}<br />{$rclinks}<br />{$rclistfrom}";
}