Пример #1
0
function wikiplugin_sf($data, $params)
{
    if (function_exists("curl_init")) {
        # customize that (or extract it in a db)
        $sftags['bugs'] = array('64258', '506846');
        $sftags['rfe'] = array('64258', '506849');
        $sftags['patches'] = array('64258', '506848');
        $sftags['support'] = array('64258', '506847');
        $sftags['jgbugs'] = array('43118', '435210');
        $sftags['jgsupport'] = array('43118', '435211');
        $sftags['jgrfe'] = array('43118', '435213');
        extract($params, EXTR_SKIP);
        if (isset($tag) and isset($sftags["{$tag}"]) and is_array($sftags["{$tag}"])) {
            list($sf_group_id, $sf_atid) = $sftags["{$tag}"];
        } else {
            $sf_group_id = isset($groupid) ? "{$groupid}" : $sftags[DEFAULT_TAG][0];
            $sf_atid = isset($atid) ? "{$atid}" : $sftags[DEFAULT_TAG][1];
            $tag = DEFAULT_TAG;
        }
        if (!isset($aid)) {
            //return "__please use (aid=>xxx) as parameters__";
            return "<b>please use (aid=>xxx) as parameters</b>";
        }
        $label = get_artifact_label($sf_group_id, $sf_atid, $aid);
        //$back = "[http://sf.net/tracker/index.php?func=detail&amp;aid=$aid&amp;group_id=$sf_group_id&amp;atid=$sf_atid|$tag:#$aid: $label|nocache]";
        $back = "<a href='http://sf.net/tracker/index.php?func=detail&amp;aid={$aid}&amp;group_id={$sf_group_id}&amp;atid={$sf_atid}' target='_blank' title='{$tag}:#{$aid}' class='wiki'>{$label}</a>";
    } else {
        $back = "SF plugin : You need php-curl module to be loaded to use that feature.";
    }
    return $back;
}
Пример #2
0
function wikiplugin_sf($data, $params)
{
    if (function_exists('curl_init')) {
        if (empty($params['itemid']) || empty($params['groupid']) || empty($params['trackerid'])) {
            return 'Plugin SF failed. One or more of the following parameters are missing: groupid, trackerid or itemid.';
        }
        $title = empty($params['title']) ? 'Item' : $params['title'];
        $label = get_artifact_label($params['groupid'], $params['trackerid'], $params['itemid']);
        $back = '<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=' . $params['itemid'] . '&group_id=' . $params['groupid'] . '&atid=' . $params['trackerid'] . '" target="_blank" title="' . $title . ' ' . $params['itemid'] . '" class="wiki external" rel="external nofollow">' . $label . '</a>';
    } else {
        $back = 'Plugin SF failed: The php-curl module must be loaded to use this plugin.';
    }
    return $back;
}