// // // File: // xhtml2wiki.php // XHTML を PukiWiki の構文に変換 // error_reporting(0); $post = isset($_POST['s']) ? $_POST['s'] : $_GET['s']; $line_break = isset($_POST['lb']) ? $_POST['lb'] : $_GET['lb']; if (get_magic_quotes_gpc()) { $post = stripslashes($post); } define('DEBUG', !empty($_GET['debug'])); $source = str_replace(array("\r\n", "\r"), "\n", $post); $postdata = xhtml2wiki($source); Send_xml($postdata); function debug($data) { $file = dirname(__FILE__) . '/debug.txt'; @unlink($file); file_put_contents($file, $data); } // XML 形式で出力 function Send_xml($postdata) { $postdata = trim($postdata, "\n") . "\n"; $out = '<?xml version="1.0" encoding="UTF-8" ?>' . "\n"; $out .= '<res><![CDATA[' . $postdata . ']]></res>'; // 出力 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
$_ol_left_margin = $xpwiki->root->_ol_left_margin; $_ol_margin = $xpwiki->root->_ol_margin; $_dl_left_margin = $xpwiki->root->_dl_left_margin; $_dl_margin = $xpwiki->root->_dl_margin; $_list_pad_str = $xpwiki->root->_list_pad_str; $preformat_ltrim = $xpwiki->root->preformat_ltrim; $guiedit_line_rules = $xpwiki->root->line_rules; // Over write $guiedit_line_rules['%%%(?!%)((?:(?!%%%).)*)%%%'] = '<u>$1</u>'; $guiedit_line_rules['%%(?!%)((?:(?!%%).)*)%%'] = '<strike>$1</strike>'; $guiedit_line_rules["'''(?!')((?:(?!''').)*)'''"] = '<em>$1</em>'; $guiedit_line_rules["''(?!')((?:(?!'').)*)''"] = '<strong>$1</strong>'; $guiedit_line_rules["\r"] = '<br />' . "\n"; $source = guiedit_convert_html($source); } Send_xml($source, strval($line_break)); function _htmlspecialchars($str, $flags = ENT_COMPAT, $encoding = null, $double_encode = true) { if (is_null($encoding)) { $encoding = 'UTF-8'; } return htmlspecialchars($str, $flags, $encoding, $double_encode); } function debug($data) { $file = dirname(__FILE__) . '/debug.txt'; @unlink($file); file_put_contents($file, $data); } // XML 形式で出力 function Send_xml($body, $line_break)