function process_request($request) { @ini_set('display_errors', 0); // we don't want to show PHP errors inside XML $titlexml = qa_xml(qa_opt('site_title')); $template = str_replace('_searchTerms_placeholder_', '{searchTerms}', qa_path_absolute('search', array('q' => '_searchTerms_placeholder_'))); header('Content-type: text/xml; charset=utf-8'); echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; echo '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">' . "\n"; echo "\t<ShortName>" . $titlexml . "</ShortName>\n"; echo "\t<Description>" . qa_xml(qa_lang('main/search_button')) . ' ' . $titlexml . "</Description>\n"; echo "\t" . '<Url type="text/html" method="get" template="' . qa_xml($template) . '"/>' . "\n"; echo "\t<InputEncoding>UTF-8</InputEncoding>\n"; echo '</OpenSearchDescription>' . "\n"; return null; }
/** * @deprecated This function will become private in Q2A 1.8. It is specific to this plugin and * should not be used by outside code. */ public function sitemap_output($request, $priority) { echo "\t<url>\n" . "\t\t<loc>" . qa_xml(qa_path($request, null, qa_opt('site_url'))) . "</loc>\n" . "\t\t<priority>" . max(0, min(1.0, $priority)) . "</priority>\n" . "\t</url>\n"; }
function sitemap_index_output($request) { echo "\t<sitemap>\n" . "\t\t<loc>" . qa_xml(qa_path($request, null, qa_opt('site_url'))) . "</loc>\n" . "\t</sitemap>\n"; }
$urlxml = qa_xml(qa_q_path($question['postid'], $question['title'], true, @$question['obasetype'], @$question['opostid'])); } if (isset($blockwordspreg)) { $question['title'] = qa_block_words_replace($question['title'], $blockwordspreg); } // Build the inner XML structure for each item $lines[] = '<item>'; $lines[] = '<title>' . qa_xml($titleprefix . $question['title']) . '</title>'; $lines[] = '<link>' . $urlxml . '</link>'; if (isset($htmlcontent)) { $lines[] = '<description>' . qa_xml($htmlcontent) . '</description>'; } if (isset($question['categoryname'])) { $lines[] = '<category>' . qa_xml($question['categoryname']) . '</category>'; } $lines[] = '<guid isPermaLink="true">' . $urlxml . '</guid>'; if (isset($time)) { $lines[] = '<pubDate>' . qa_xml(gmdate('r', $time)) . '</pubDate>'; } $lines[] = '</item>'; } $lines[] = '</channel>'; $lines[] = '</rss>'; // Disconnect here, once all output is ready to go qa_db_disconnect(); // Output the XML - and we're done! header('Content-type: text/xml; charset=utf-8'); echo implode("\n", $lines); /* Omit PHP closing tag to help avoid accidental output */