25 'title' => __('Overview'), |
25 'title' => __('Overview'), |
26 'content' => |
26 'content' => |
27 '<p>' . __('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.') . '</p> |
27 '<p>' . __('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.') . '</p> |
28 <p>' . __('Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of all the template files. Clicking once on any file name causes the file to appear in the large Editor box.') . '</p> |
28 <p>' . __('Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of all the template files. Clicking once on any file name causes the file to appear in the large Editor box.') . '</p> |
29 <p>' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Lookup takes you to a web page with reference material about that particular function.') . '</p> |
29 <p>' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Lookup takes you to a web page with reference material about that particular function.') . '</p> |
|
30 <p id="newcontent-description">' . __('In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key.') . '</p> |
30 <p>' . __('After typing in your edits, click Update File.') . '</p> |
31 <p>' . __('After typing in your edits, click Update File.') . '</p> |
31 <p>' . __('<strong>Advice:</strong> think very carefully about your site crashing if you are live-editing the theme currently in use.') . '</p> |
32 <p>' . __('<strong>Advice:</strong> think very carefully about your site crashing if you are live-editing the theme currently in use.') . '</p> |
32 <p>' . __('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="http://codex.wordpress.org/Child_Themes" target="_blank">child theme</a> instead.') . '</p>' . |
33 <p>' . __('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="http://codex.wordpress.org/Child_Themes" target="_blank">child theme</a> instead.') . '</p>' . |
33 ( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' ) |
34 ( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' ) |
34 ) ); |
35 ) ); |
43 ); |
44 ); |
44 |
45 |
45 wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) ); |
46 wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) ); |
46 |
47 |
47 if ( $theme ) |
48 if ( $theme ) |
48 $stylesheet = urldecode( $theme ); |
49 $stylesheet = $theme; |
49 else |
50 else |
50 $stylesheet = get_stylesheet(); |
51 $stylesheet = get_stylesheet(); |
51 |
52 |
52 $theme = wp_get_theme( $stylesheet ); |
53 $theme = wp_get_theme( $stylesheet ); |
53 |
54 |
65 |
66 |
66 if ( empty( $file ) ) { |
67 if ( empty( $file ) ) { |
67 $relative_file = 'style.css'; |
68 $relative_file = 'style.css'; |
68 $file = $allowed_files['style.css']; |
69 $file = $allowed_files['style.css']; |
69 } else { |
70 } else { |
70 $relative_file = urldecode( stripslashes( $file ) ); |
71 $relative_file = stripslashes( $file ); |
71 $file = $theme->get_stylesheet_directory() . '/' . $relative_file; |
72 $file = $theme->get_stylesheet_directory() . '/' . $relative_file; |
72 } |
73 } |
73 |
74 |
74 validate_file_to_edit( $file, $allowed_files ); |
75 validate_file_to_edit( $file, $allowed_files ); |
75 $scrollto = isset( $_REQUEST['scrollto'] ) ? (int) $_REQUEST['scrollto'] : 0; |
76 $scrollto = isset( $_REQUEST['scrollto'] ) ? (int) $_REQUEST['scrollto'] : 0; |
196 <?php if ( $error ) : |
197 <?php if ( $error ) : |
197 echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>'; |
198 echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>'; |
198 else : ?> |
199 else : ?> |
199 <form name="template" id="template" action="theme-editor.php" method="post"> |
200 <form name="template" id="template" action="theme-editor.php" method="post"> |
200 <?php wp_nonce_field( 'edit-theme_' . $file . $stylesheet ); ?> |
201 <?php wp_nonce_field( 'edit-theme_' . $file . $stylesheet ); ?> |
201 <div><textarea cols="70" rows="30" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea> |
202 <div><textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea> |
202 <input type="hidden" name="action" value="update" /> |
203 <input type="hidden" name="action" value="update" /> |
203 <input type="hidden" name="file" value="<?php echo esc_attr( $relative_file ); ?>" /> |
204 <input type="hidden" name="file" value="<?php echo esc_attr( $relative_file ); ?>" /> |
204 <input type="hidden" name="theme" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" /> |
205 <input type="hidden" name="theme" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" /> |
205 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> |
206 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> |
206 </div> |
207 </div> |
207 <?php if ( ! empty( $functions ) ) : ?> |
208 <?php if ( ! empty( $functions ) ) : ?> |
208 <div id="documentation" class="hide-if-no-js"> |
209 <div id="documentation" class="hide-if-no-js"> |
209 <label for="docs-list"><?php _e('Documentation:') ?></label> |
210 <label for="docs-list"><?php _e('Documentation:') ?></label> |
210 <?php echo $docs_select; ?> |
211 <?php echo $docs_select; ?> |
211 <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'); }" /> |
212 <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'); }" /> |
217 <p><?php if ( is_writeable( $file ) ) { ?><strong><?php _e( 'Caution:' ); ?></strong><?php } ?> |
218 <p><?php if ( is_writeable( $file ) ) { ?><strong><?php _e( 'Caution:' ); ?></strong><?php } ?> |
218 <?php _e( 'This is a file in your current parent theme.' ); ?></p> |
219 <?php _e( 'This is a file in your current parent theme.' ); ?></p> |
219 <?php endif; ?> |
220 <?php endif; ?> |
220 <?php |
221 <?php |
221 if ( is_writeable( $file ) ) : |
222 if ( is_writeable( $file ) ) : |
222 submit_button( __( 'Update File' ), 'primary', 'submit', true, array( 'tabindex' => '2' ) ); |
223 submit_button( __( 'Update File' ), 'primary', 'submit', true ); |
223 else : ?> |
224 else : ?> |
224 <p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p> |
225 <p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p> |
225 <?php endif; ?> |
226 <?php endif; ?> |
226 </div> |
227 </div> |
227 </form> |
228 </form> |