Esempio n. 1
0
function plugin_bugtrack_list_pageinfo($page, $no = NULL, $recurse = TRUE)
{
    global $WikiName, $InterWikiName, $BracketName, $_plugin_bugtrack;
    if ($no === NULL) {
        $no = preg_match('/\\/([0-9]+)$/', $page, $matches) ? $matches[1] : 0;
    }
    $source = get_source($page);
    // Check 'moved' page _just once_
    $regex = "/move\\s*to\\s*({$WikiName}|{$InterWikiName}|\\[\\[{$BracketName}\\]\\])/";
    $match = array();
    if ($recurse && preg_match($regex, $source[0], $match)) {
        return plugin_bugtrack_list_pageinfo(strip_bracket($match[1]), $no, FALSE);
    }
    $body = join("\n", $source);
    foreach (array('summary', 'name', 'priority', 'state', 'category') as $item) {
        $regex = '/-\\s*' . preg_quote($_plugin_bugtrack[$item], '/') . '\\s*:(.*)/';
        if (preg_match($regex, $body, $matches)) {
            if ($item == 'name') {
                ${$item} = strip_bracket(trim($matches[1]));
            } else {
                ${$item} = trim($matches[1]);
            }
        } else {
            ${$item} = '';
            // Data not found
        }
    }
    if (preg_match("/\\*([^\n]*)/", $body, $matches)) {
        $summary = $matches[1];
        make_heading($summary);
    }
    return array($page, $no, $summary, $name, $priority, $state, $category);
}
Esempio n. 2
0
function plugin_bugtrack_list_pageinfo($page, $no = NULL, $recurse = TRUE)
{
    global $_plugin_bugtrack;
    if ($no === NULL) {
        $no = preg_match('/\\/([0-9]+)$/', $page, $matches) ? $matches[1] : 0;
    }
    $source = Factory::Wiki($page)->get();
    // Check 'moved' page _just once_
    $regex = '/move\\s*to\\s*(' . RendererDefines::WIKINAME_PATTERN . '|' . RendererDefines::INTERWIKINAME_PATTERN . '|\\[\\[' . RendererDefines::BRACKETNAME_PATTERN . '\\]\\])/';
    $match = array();
    if ($recurse && preg_match($regex, $source[0], $match)) {
        return plugin_bugtrack_list_pageinfo(Utility::stripBracket($match[1]), $no, FALSE);
    }
    $body = join("\n", $source);
    foreach (array('summary', 'name', 'priority', 'state', 'category') as $item) {
        $regex = '/-\\s*' . preg_quote($_plugin_bugtrack[$item], '/') . '\\s*:(.*)/';
        if (preg_match($regex, $body, $matches)) {
            if ($item == 'name') {
                ${$item} = Utility::stripBracket(trim($matches[1]));
            } else {
                ${$item} = trim($matches[1]);
            }
        } else {
            ${$item} = '';
            // Data not found
        }
    }
    if (preg_match("/\\*([^\n]*)/", $body, $matches)) {
        $summary = Rules::removeHeading($matches[0]);
    }
    return array($page, $no, $summary, $name, $priority, $state, $category);
}