git-svn-id: http://svn.automattic.com/wordpress/trunk@14718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -312,76 +312,6 @@ function wp_doc_link_parse( $content ) {
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the language to use for CodePress syntax highlighting,
|
||||
* based only on a filename.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param string $filename The name of the file to be highlighting
|
||||
**/
|
||||
function codepress_get_lang( $filename ) {
|
||||
$codepress_supported_langs = apply_filters( 'codepress_supported_langs',
|
||||
array( '.css' => 'css',
|
||||
'.js' => 'javascript',
|
||||
'.php' => 'php',
|
||||
'.html' => 'html',
|
||||
'.htm' => 'html',
|
||||
'.txt' => 'text'
|
||||
) );
|
||||
$extension = substr( $filename, strrpos( $filename, '.' ) );
|
||||
if ( $extension && array_key_exists( $extension, $codepress_supported_langs ) )
|
||||
return $codepress_supported_langs[$extension];
|
||||
|
||||
return 'generic';
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Javascript required to make CodePress work on the theme/plugin editors.
|
||||
*
|
||||
* This code is attached to the action admin_print_footer_scripts.
|
||||
*
|
||||
* @since 2.8
|
||||
**/
|
||||
function codepress_footer_js() {
|
||||
// Script-loader breaks CP's automatic path-detection, thus CodePress.path
|
||||
// CP edits in an iframe, so we need to grab content back into normal form
|
||||
?><script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
var codepress_path = '<?php echo includes_url('js/codepress/'); ?>';
|
||||
jQuery('#template').submit(function(){
|
||||
if (jQuery('#newcontent_cp').length)
|
||||
jQuery('#newcontent_cp').val(newcontent.getCode()).removeAttr('disabled');
|
||||
});
|
||||
jQuery('#codepress-on').hide();
|
||||
jQuery('#codepress-off').show();
|
||||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether to use CodePress.
|
||||
*
|
||||
* @since 2.8
|
||||
**/
|
||||
function use_codepress() {
|
||||
|
||||
if ( isset($_GET['codepress']) ) {
|
||||
$on = 'on' == $_GET['codepress'] ? 'on' : 'off';
|
||||
set_user_setting( 'codepress', $on );
|
||||
} else {
|
||||
$on = get_user_setting('codepress', 'on');
|
||||
}
|
||||
|
||||
if ( 'on' == $on ) {
|
||||
add_action( 'admin_print_footer_scripts', 'codepress_footer_js' );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves option for number of rows when listing posts, pages, comments, etc.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user