git-svn-id: http://svn.automattic.com/wordpress/trunk@14718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -2155,8 +2155,7 @@ td.plugin-title {
|
||||
/* Global classes */
|
||||
|
||||
.wp-hidden-children .wp-hidden-child,
|
||||
.ui-tabs-hide,
|
||||
#codepress-off {
|
||||
.ui-tabs-hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,4 +162,39 @@ function remove_option_update_handler( $option_group, $option_name, $sanitize_ca
|
||||
return unregister_setting( $option_group, $option_name, $sanitize_callback );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the language to use for CodePress syntax highlighting.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @deprecated 3.0.0
|
||||
*
|
||||
* @param string $filename
|
||||
**/
|
||||
function codepress_get_lang( $filename ) {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Javascript required to make CodePress work on the theme/plugin editors.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @deprecated 3.0.0
|
||||
**/
|
||||
function codepress_footer_js() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether to use CodePress.
|
||||
*
|
||||
* @since 2.8
|
||||
* @deprecated 3.0.0
|
||||
**/
|
||||
function use_codepress() {
|
||||
_deprecated_function( __FUNCTION__, '3.0' );
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -127,8 +127,6 @@ default:
|
||||
}
|
||||
|
||||
$content = htmlspecialchars( $content );
|
||||
$codepress_lang = codepress_get_lang($real_file);
|
||||
|
||||
?>
|
||||
<?php if (isset($_GET['a'])) : ?>
|
||||
<div id="message" class="updated"><p><?php _e('File edited successfully.') ?></p></div>
|
||||
@@ -206,7 +204,7 @@ foreach ( $plugin_files as $plugin_file ) :
|
||||
</div>
|
||||
<form name="template" id="template" action="plugin-editor.php" method="post">
|
||||
<?php wp_nonce_field('edit-plugin_' . $file) ?>
|
||||
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea>
|
||||
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
|
||||
<input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" />
|
||||
|
||||
@@ -102,7 +102,6 @@ default:
|
||||
}
|
||||
|
||||
$content = htmlspecialchars( $content );
|
||||
$codepress_lang = codepress_get_lang($file);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -195,7 +194,7 @@ if ($allowed_files) :
|
||||
<?php if (!$error) { ?>
|
||||
<form name="template" id="template" action="theme-editor.php" method="post">
|
||||
<?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
|
||||
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea>
|
||||
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
|
||||
<input type="hidden" name="theme" value="<?php echo esc_attr($theme) ?>" />
|
||||
|
||||
Reference in New Issue
Block a user