Пример #1
0
function do_wikimediacommons($formatter, $params = array())
{
    global $DBInfo;
    $retval = array();
    $params['call'] = 1;
    $params['retval'] =& $retval;
    $ret = macro_WikimediaCommons($formatter, $params['url'], $params);
    if (empty($params['image']) && preg_match('@text/@', $_SERVER['HTTP_ACCEPT'])) {
        echo $ret;
    } elseif (!empty($params['image']) || preg_match('@image/@', $_SERVER['HTTP_ACCEPT'])) {
        header('Pragma: no-cache');
        header('Cache-Control: public, max-age=0, s-maxage=0');
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
        header('Cache-Control: no-store, no-cache, must-revalidate', false);
        $formatter->send_header(array('Status: 302', 'Location: ' . $retval['url']));
    } else {
        // json
        echo json_encode($retval);
    }
}
Пример #2
0
function do_wikimediacommons($formatter, $params = array())
{
    global $DBInfo;
    $ret = macro_WikimediaCommons($formatter, $params['value']);
    echo $ret;
}