tra('SourceForge'), 'documentation' => 'PluginSF', 'description' => tra('Creates a link to SourceForge tracker items'), 'prefs' => [ 'wikiplugin_sf' ], 'body' => tra('text'), 'iconname' => 'link', 'introduced' => 1, 'params' => [ 'groupid' => [ 'required' => true, 'name' => tra('Group ID'), 'description' => tra('SourceForge project ID (shows as group_id in the URL of a tracker item'), 'since' => '1', 'filter' => 'digits', 'default' => '', ], 'trackerid' => [ 'required' => true, 'name' => tra('Tracker ID'), 'description' => tra('SourceForge tracker ID (shows as atid in the URL of a tracker item'), 'since' => '1', 'filter' => 'digits', 'default' => '', 'profile_reference' => 'tracker', ], 'itemid' => [ 'required' => true, 'name' => tra('Item ID'), 'description' => tra('SourceForge item ID (shows as aid in the URL of a tracker item'), 'since' => '1', 'filter' => 'digits', 'default' => '', 'profile_reference' => 'tracker_item', ], 'title' => [ 'required' => false, 'name' => tra('Link title'), 'description' => tra('First part of link tooltip identifying the type of tracker item (bug, feature request, patch or support request).'), 'filter' => 'alpha', 'default' => 'Item', 'since' => 7.0, ], ], ]; } function get_artifact_label($gid, $atid, $aid, $reload = false) { $agent = $_SERVER['HTTP_USER_AGENT']; $cachefile = "temp/sftrackers.cache.$gid.$atid.$aid"; $cachelimit = time() - 60 * 60 * SF_CACHE; $url = 'http://sourceforge.net/tracker/index.php?func=detail&aid=' . $aid . '&group_id=' . $gid . '&atid=' . $atid; if (! is_file($cachefile)) { $reload = true; } $back = false; if ($reload or (filemtime($cachefile) < $cachelimit)) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_REFERER, $url); $buffer = curl_exec($ch); curl_close($ch); if (preg_match("/