From 1f2eb2f8b811457e5c5089d517550df42d57e284 Mon Sep 17 00:00:00 2001 From: azaozz Date: Sun, 7 Jun 2009 01:52:44 +0000 Subject: [PATCH] Allow CodePress to be disabled from Screen Options, see #10027 git-svn-id: http://svn.automattic.com/wordpress/trunk@11530 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/misc.php | 24 ++++++++++++++++++++++++ wp-admin/includes/template.php | 11 ++++++++--- wp-admin/plugin-editor.php | 4 ++-- wp-admin/theme-editor.php | 5 +++-- wp-admin/wp-admin.css | 3 ++- wp-includes/js/codepress/codepress.js | 4 ++-- 6 files changed, 41 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index 59544d04e..d020e74ad 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -341,11 +341,35 @@ 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(); /* ]]> */ ' . __('Enable syntax highlighting') . '' . __('Disable syntax highlighting') . "

\n"; + $show_screen = true; + break; case 'widgets': if ( !isset($_wp_contextual_help['widgets']) ) { $help = widgets_help(); $_wp_contextual_help['widgets'] = $help; } - $widgets_access = '

' . __('Enable accessibility mode') . '' . __('Disable accessibility mode') . "

\n"; + $settings = '

' . __('Enable accessibility mode') . '' . __('Disable accessibility mode') . "

\n"; $show_screen = true; break; } @@ -3500,7 +3505,7 @@ function screen_meta($screen) { - +
diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index 57ff60fcc..e297ef4ce 100644 --- a/wp-admin/plugin-editor.php +++ b/wp-admin/plugin-editor.php @@ -83,8 +83,8 @@ default: exit; } - wp_enqueue_script( 'codepress' ); - add_action( 'admin_print_footer_scripts', 'codepress_footer_js' ); + if ( use_codepress() ) + wp_enqueue_script( 'codepress' ); // List of allowable extensions $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include'); diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php index 7713fa5db..db79d786e 100644 --- a/wp-admin/theme-editor.php +++ b/wp-admin/theme-editor.php @@ -77,8 +77,9 @@ default: if ( !current_user_can('edit_themes') ) wp_die('

'.__('You do not have sufficient permissions to edit themes for this blog.').'

'); - wp_enqueue_script( 'codepress' ); - add_action( 'admin_print_footer_scripts', 'codepress_footer_js' ); + if ( use_codepress() ) + wp_enqueue_script( 'codepress' ); + require_once('admin-header.php'); update_recently_edited($file); diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index b7a693b26..508ad9b46 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -2116,7 +2116,8 @@ td.plugin-title { /* Global classes */ .wp-hidden-children .wp-hidden-child, -.ui-tabs-hide { +.ui-tabs-hide, +#codepress-off { display: none; } diff --git a/wp-includes/js/codepress/codepress.js b/wp-includes/js/codepress/codepress.js index 7698b6038..804f29a00 100644 --- a/wp-includes/js/codepress/codepress.js +++ b/wp-includes/js/codepress/codepress.js @@ -122,8 +122,8 @@ CodePress.run = function() { if (navigator.userAgent.toLowerCase().indexOf('webkit') != -1) return; CodePress.path = codepress_path; - t = document.getElementsByTagName('textarea'); - for(var i=0,n=t.length;i