示例#1
0
 function parse($args, $page)
 {
     global $pagestore, $MinEntries, $DayLimit, $full, $page, $Entity;
     global $FlgChr, $UserName, $UseHotPages;
     list($args, $ignoreRegExp) = explode(' ', $args, 2);
     $text = '';
     if (strstr($args, '*')) {
         $list = $pagestore->allpages();
     } else {
         if (strstr($args, '?')) {
             $list = $pagestore->newpages();
         } else {
             if (strstr($args, '~')) {
                 $list = $pagestore->emptypages();
             } else {
                 $parsed = parseText($args, array('parse_wikiname', 'parse_freelink'), '');
                 $pagenames = array();
                 preg_replace('/' . $FlgChr . '(\\d+)' . $FlgChr . '/e', '$pagenames[]=$Entity[\\1][1]', $parsed);
                 $list = $pagestore->givenpages($pagenames);
             }
         }
     }
     if (count($list) == 0) {
         return '';
     }
     usort($list, 'catSort');
     if ($UseHotPages) {
         $hotPagesList = $pagestore->getHotPages();
     } else {
         $hotPagesList = array();
     }
     $newPages = $pagestore->getNewPages();
     $now = time();
     for ($i = 0; $i < count($list); $i++) {
         if ($ignoreRegExp) {
             if (@preg_match($ignoreRegExp, $list[$i][1])) {
                 continue;
             }
         }
         if ($DayLimit && $i >= $MinEntries && !$full && $now - $list[$i][0] > $DayLimit * 24 * 60 * 60) {
             break;
         }
         $text = $text . html_category($list[$i][0], $list[$i][1], $list[$i][2], $list[$i][3], $list[$i][5], $list[$i][7], $hotPagesList, $newPages);
         // Do not put a newline on the last one.
         if ($i < count($list) - 1) {
             $text = $text . html_newline();
         }
     }
     if ($i < count($list)) {
         $text = $text . html_fulllist($page, count($list));
     }
     return $text;
 }
示例#2
0
function view_macro_category($args)
{
    global $pagestore, $MinEntries, $DayLimit, $full, $page, $Entity;
    global $FlgChr;
    $text = '';
    if (strstr($args, '*')) {
        $list = $pagestore->allpages();
    } else {
        if (strstr($args, '?')) {
            $list = $pagestore->newpages();
        } else {
            if (strstr($args, '~')) {
                $list = $pagestore->emptypages();
            } else {
                $parsed = parseText($args, array('parse_freelink', 'parse_wikiname'), '');
                $pagenames = array();
                preg_replace('/' . $FlgChr . '!?(\\d+)' . $FlgChr . '/e', '$pagenames[]=$Entity[\\1][1]', $parsed);
                $list = $pagestore->givenpages($pagenames);
            }
        }
    }
    if (count($list) == 0) {
        return '';
    }
    usort($list, 'catSort');
    $now = time();
    for ($i = 0; $i < count($list); $i++) {
        $editTime = mktime(substr($list[$i][0], 8, 2), substr($list[$i][0], 10, 2), substr($list[$i][0], 12, 2), substr($list[$i][0], 4, 2), substr($list[$i][0], 6, 2), substr($list[$i][0], 0, 4));
        if ($DayLimit && $i >= $MinEntries && !$full && $now - $editTime > $DayLimit * 24 * 60 * 60) {
            break;
        }
        $text = $text . html_category($list[$i][0], $list[$i][1], $list[$i][2], $list[$i][3], $list[$i][5]);
        if ($i < count($list) - 1) {
            $text = $text . html_newline();
        }
    }
    if ($i < count($list)) {
        $text = $text . html_fulllist($page, count($list));
    }
    return $text;
}
function view_macro_category($args)
{
    global $pagestore, $MinEntries, $DayLimit, $full, $page, $Entity;
    global $FlgChr;
    $text = '';
    if (strstr($args, '*')) {
        $list = $pagestore->allpages();
    } else {
        if (strstr($args, '?')) {
            $list = $pagestore->newpages();
        } else {
            if (strstr($args, '~')) {
                $list = $pagestore->emptypages();
            } else {
                $parsed = parseText($args, array('parse_wikiname', 'parse_freelink'), '');
                $pagenames = array();
                preg_replace('/' . $FlgChr . '(\\d+)' . $FlgChr . '/e', '$pagenames[]=$Entity[\\1][1]', $parsed);
                $list = $pagestore->givenpages($pagenames);
            }
        }
    }
    if (count($list) == 0) {
        return '';
    }
    usort($list, 'catSort');
    $now = time();
    //for($i = 0; $i < count($list); $i++)
    foreach ($list as $i => $lpage) {
        $editTime = $lpage['time'];
        if ($DayLimit && $i >= $MinEntries && !$full && $now - $editTime > $DayLimit * 24 * 60 * 60) {
            break;
        }
        $text = $text . html_category($lpage['time'], $lpage, $lpage['author'], $lpage['username'], $lpage['comment']);
        $text .= html_newline();
    }
    if ($i < count($list) - 1) {
        $text .= html_fulllist($page, count($list));
    }
    return $text;
}