Changeset 11214 for trunk/wp-admin/plugin-editor.php
- Timestamp:
- 05/06/2009 04:08:13 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/plugin-editor.php
r11204 r11214 85 85 86 86 wp_enqueue_script( 'codepress' ); 87 add_action( 'admin_print_footer_scripts', 'codepress_footer_js' ); 88 require_once('admin-header.php'); 89 90 update_recently_edited(WP_PLUGIN_DIR . '/' . $file); 91 87 add_action( 'admin_print_footer_scripts', 'codepress_footer_js' ); 88 92 89 // List of allowable extensions 93 90 $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include'); 94 $extra_extensions = apply_filters('editable_extensions', null); 95 if ( is_array($extra_extensions) ) 96 $editable_extensions = array_merge($editable_extensions, $extra_extensions); 91 $editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions); 97 92 98 93 if ( ! is_file($real_file) ) { 99 $error = __('No such file exists! Double check the name and try again.');94 wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.'))); 100 95 } else { 101 96 // Get the extension of the file … … 104 99 // If extension is not in the acceptable list, skip it 105 100 if ( !in_array( $ext, $editable_extensions) ) 106 $error = __('Files of this type are not editable.');101 wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.'))); 107 102 } 108 103 } 109 110 if ( ! $error ) { 111 $content = file_get_contents( $real_file ); 112 113 if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { 114 $functions = wp_doc_link_parse( $content ); 115 116 $docs_select = '<select name="docs-list" id="docs-list">'; 117 $docs_select .= '<option value="">' . __( 'Function Name...' ) . '</option>'; 118 foreach ( $functions as $function) { 119 $docs_select .= '<option value="' . esc_attr( $function ) . '">' . htmlspecialchars( $function ) . '()</option>'; 120 } 121 $docs_select .= '</select>'; 104 105 require_once('admin-header.php'); 106 107 update_recently_edited(WP_PLUGIN_DIR . '/' . $file); 108 109 $content = file_get_contents( $real_file ); 110 111 if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { 112 $functions = wp_doc_link_parse( $content ); 113 114 $docs_select = '<select name="docs-list" id="docs-list">'; 115 $docs_select .= '<option value="">' . __( 'Function Name...' ) . '</option>'; 116 foreach ( $functions as $function) { 117 $docs_select .= '<option value="' . esc_attr( $function ) . '">' . htmlspecialchars( $function ) . '()</option>'; 122 118 } 123 124 $content = htmlspecialchars( $content ); 125 $codepress_lang = codepress_get_lang($real_file); 126 } 119 $docs_select .= '</select>'; 120 } 121 122 $content = htmlspecialchars( $content ); 123 $codepress_lang = codepress_get_lang($real_file); 127 124 128 125 ?> … … 142 139 <div class="bordertitle"> 143 140 <form id="themeselector" action="plugin-editor.php" method="post"> 144 <strong><label for=" theme"><?php _e('Select plugin to edit:'); ?> </label></strong>141 <strong><label for="plugin"><?php _e('Select plugin to edit:'); ?> </label></strong> 145 142 <select name="plugin" id="plugin"> 146 143 <?php … … 196 193 } 197 194 ?> 198 <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo $plugin_file; ?>& plugin=<?php echo $plugin; ?>"><?php echo $plugin_file ?></a></li>195 <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo $plugin_file; ?>&plugin=<?php echo $plugin; ?>"><?php echo $plugin_file ?></a></li> 199 196 <?php endforeach; ?> 200 197 </ul> 201 198 </div> 202 <?php if ( ! $error ) { ?>203 199 <form name="template" id="template" action="plugin-editor.php" method="post"> 204 200 <?php wp_nonce_field('edit-plugin_' . $file) ?> … … 209 205 </div> 210 206 <?php if ( count( $functions ) ) : ?> 211 <div id="documentation"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Lookup' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '& locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" /></div>207 <div id="documentation"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Lookup' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" /></div> 212 208 <?php endif; ?> 213 209 <?php if ( is_writeable($real_file) ) : ?> … … 227 223 <?php endif; ?> 228 224 </form> 229 <?php230 } else {231 echo '<div class="error"><p>' . $error . '</p></div>';232 }233 ?>234 225 <div class="clear"> </div> 235 226 </div>
Note: See TracChangeset
for help on using the changeset viewer.