Created
December 17, 2008 02:09
-
-
Save wtnabe/36915 to your computer and use it in GitHub Desktop.
PukiWiki で page の source をそのまま返す raw plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* page の内容をそのまま HTML に整形せずに返す | |
* | |
* @since 2008-12-17 | |
*/ | |
function plugin_raw_action() { | |
global $vars, $_title_invalidwn, $_msg_invalidiwn; | |
$page = isset( $vars['page'] ) ? $vars['page'] : ''; | |
if ( is_page( $page ) ) { | |
check_readable( $page, true, true ); | |
header_lastmod( $page ); | |
header( 'Content-Type: text/plain; charset='. SOURCE_ENCODING ); | |
print join( '', get_source( $page ) ); | |
exit; | |
} else { | |
return array( 'msg' => $_title_invalidwn, | |
'body' => str_replace( '$1', htmlspecialchars( $page ), | |
str_replace( '$2', 'WikiName', $_msg_invalidiwn ) ) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment