Changeset 11788 for trunk/wp-admin/plugin-editor.php
- Timestamp:
- 08/08/2009 07:22:19 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/plugin-editor.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/plugin-editor.php
r11671 r11788 10 10 require_once('admin.php'); 11 11 12 if ( !current_user_can('edit_plugins') ) 13 wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>'); 14 12 15 $title = __("Edit Plugins"); 13 16 $parent_file = 'plugins.php'; … … 34 37 $file = validate_file_to_edit($file, $plugin_files); 35 38 $real_file = WP_PLUGIN_DIR . '/' . $file; 39 $scrollto = isset($_REQUEST['scrollto']) ? (int) $_REQUEST['scrollto'] : 0; 36 40 37 41 switch ( $action ) { … … 40 44 41 45 check_admin_referer('edit-plugin_' . $file); 42 43 if ( !current_user_can('edit_plugins') )44 wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');45 46 46 47 $newcontent = stripslashes($_POST['newcontent']); … … 54 55 if ( is_plugin_active($file) ) 55 56 deactivate_plugins($file, true); 56 wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1 "));57 wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto")); 57 58 exit; 58 59 } 59 wp_redirect("plugin-editor.php?file=$file&a=te ");60 } else { 61 wp_redirect("plugin-editor.php?file=$file ");60 wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto"); 61 } else { 62 wp_redirect("plugin-editor.php?file=$file&scrollto=$scrollto"); 62 63 } 63 64 exit; … … 66 67 67 68 default: 68 69 if ( !current_user_can('edit_plugins') )70 wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');71 69 72 70 if ( isset($_GET['liveupdate']) ) { … … 80 78 activate_plugin($file, "plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error 81 79 82 wp_redirect("plugin-editor.php?file=$file&a=te ");80 wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto"); 83 81 exit; 84 82 } … … 206 204 <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" /> 207 205 <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" /> 206 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> 208 207 </div> 209 208 <?php if ( !empty( $docs_select ) ) : ?> … … 228 227 <br class="clear" /> 229 228 </div> 229 <script type="text/javascript"> 230 /* <![CDATA[ */ 231 jQuery(document).ready(function($){ 232 $('#template').submit(function(){ $('#scrollto').val( $('#newcontent').scrollTop() ); }); 233 $('#newcontent').scrollTop( $('#scrollto').val() ); 234 }); 235 /* ]]> */ 236 </script> 230 237 <?php 231 238 break;
Note: See TracChangeset
for help on using the changeset viewer.