function sms_board_hook_webservices_output($operation, $requests, $returns) { $keyword = $requests['keyword']; if (!$keyword) { $keyword = $requests['tag']; } if (!($operation == 'sms_board' && $keyword)) { return FALSE; } $keyword = strtoupper($keyword); $line = $requests['line']; $type = $requests['type']; $format = $requests['format']; switch ($type) { case "serialize": if ($content = sms_board_output_serialize($keyword, $line)) { $returns['modified'] = TRUE; $returns['param']['content'] = $content; $returns['param']['content-type'] = 'text/plain'; } break; case "json": if ($content = sms_board_output_json($keyword, $line)) { $returns['modified'] = TRUE; $returns['param']['content'] = $content; $returns['param']['content-type'] = 'text/json'; } break; case "xml": if ($content = sms_board_output_xml($keyword, $line)) { $returns['modified'] = TRUE; $returns['param']['content'] = $content; $returns['param']['content-type'] = 'text/xml'; } break; case "feed": // before sms_board_output_rss, and dont set content-type if ($content = sms_board_output_rss($keyword, $line, $format)) { $returns['modified'] = TRUE; $returns['param']['content'] = $content; if ($format == 'mbox') { $returns['param']['content-type'] = 'text/plain'; } else { $returns['param']['content-type'] = 'text/xml'; } } break; case "html": default: $bodybgcolor = $requests['bodybgcolor']; $oddbgcolor = $requests['oddbgcolor']; $evenbgcolor = $requests['evenbgcolor']; if ($content = sms_board_output_html($keyword, $line, $bodybgcolor, $oddbgcolor, $evenbgcolor)) { $returns['modified'] = TRUE; $returns['param']['content'] = $content; $returns['param']['content-type'] = 'text/html'; } } return $returns; }
function sms_board_hook_webservices_output($operation, $requests) { $keyword = $requests['keyword']; if (!$keyword) { $keyword = $requests['tag']; } if ($keyword) { $keyword = strtoupper($keyword); $line = $requests['line']; $type = $requests['type']; $format = $requests['format']; switch ($type) { case "serialize": $content = sms_board_output_serialize($keyword, $line); ob_end_clean(); header('Content-Type: text/plain; charset=utf-8'); $ret = $content; break; case "json": $content = sms_board_output_json($keyword, $line); ob_end_clean(); header('Content-Type: text/json; charset=utf-8'); $ret = $content; break; case "xml": $content = sms_board_output_xml($keyword, $line); ob_end_clean(); header('Content-Type: text/xml; charset=utf-8'); $ret = $content; break; case "feed": ob_end_clean(); // before sms_board_output_rss, and dont set content-type $content = sms_board_output_rss($keyword, $line, $format); $ret = $content; break; case "html": default: $bodybgcolor = $requests['bodybgcolor']; $oddbgcolor = $requests['oddbgcolor']; $evenbgcolor = $requests['evenbgcolor']; $content = sms_board_output_html($keyword, $line, $bodybgcolor, $oddbgcolor, $evenbgcolor); ob_end_clean(); header('Content-Type: text/html; charset=utf-8'); $ret = $content; } } return $ret; }