Changeset 56570 for trunk/src/wp-admin/theme-editor.php
- Timestamp:
- 09/14/2023 12:52:45 AM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/theme-editor.php
r56014 r56570 190 190 <h1><?php echo esc_html( $title ); ?></h1> 191 191 192 <?php if ( isset( $_GET['a'] ) ) : ?> 193 <div id="message" class="updated notice is-dismissible"> 194 <p><?php _e( 'File edited successfully.' ); ?></p> 195 </div> 196 <?php elseif ( is_wp_error( $edit_error ) ) : ?> 197 <div id="message" class="notice notice-error"> 198 <p><?php _e( 'There was an error while trying to update the file. You may need to fix something and try updating again.' ); ?></p> 199 <pre><?php echo esc_html( $edit_error->get_error_message() ? $edit_error->get_error_message() : $edit_error->get_error_code() ); ?></pre> 200 </div> 201 <?php endif; ?> 202 203 <?php if ( preg_match( '/\.css$/', $file ) && ! wp_is_block_theme() && current_user_can( 'customize' ) ) : ?> 204 <div id="message" class="notice-info notice"> 205 <p><strong><?php _e( 'Did you know?' ); ?></strong></p> 206 <p> 207 <?php 208 printf( 209 /* translators: %s: Link to Custom CSS section in the Customizer. */ 210 __( 'There is no need to change your CSS here — you can edit and live preview CSS changes in the <a href="%s">built-in CSS editor</a>.' ), 211 esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) ) 212 ); 213 ?> 214 </p> 215 </div> 216 <?php endif; ?> 192 <?php 193 if ( isset( $_GET['a'] ) ) { 194 wp_admin_notice( 195 __( 'File edited successfully.' ), 196 array( 197 'id' => 'message', 198 'is-dismissible' => true, 199 'additional_classes' => array( 'updated' ), 200 ) 201 ); 202 } elseif ( is_wp_error( $edit_error ) ) { 203 $error_code = esc_html( $edit_error->get_error_message() ? $edit_error->get_error_message() : $edit_error->get_error_code() ); 204 $message = '<p>' . __( 'There was an error while trying to update the file. You may need to fix something and try updating again.' ) . '</p> 205 <pre>' . $error_code . '</pre>'; 206 wp_admin_notice( 207 $message, 208 array( 209 'type' => 'error', 210 'id' => 'message', 211 ) 212 ); 213 } 214 215 if ( preg_match( '/\.css$/', $file ) && ! wp_is_block_theme() && current_user_can( 'customize' ) ) { 216 $message = '<p><strong>' . __( 'Did you know?' ) . '</strong></p><p>' . sprintf( 217 /* translators: %s: Link to Custom CSS section in the Customizer. */ 218 __( 'There is no need to change your CSS here — you can edit and live preview CSS changes in the <a href="%s">built-in CSS editor</a>.' ), 219 esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) ) 220 ) . '</p>'; 221 wp_admin_notice( 222 $message, 223 array( 224 'type' => 'info', 225 'id' => 'message', 226 ) 227 ); 228 } 229 ?> 217 230 218 231 <div class="fileedit-sub"> … … 305 318 <div> 306 319 <div class="editor-notices"> 307 <?php if ( is_child_theme() && $theme->get_stylesheet() === get_template() ) : ?> 308 <div class="notice notice-warning inline"> 309 <p> 310 <?php if ( is_writable( $file ) ) : ?> 311 <strong><?php _e( 'Caution:' ); ?></strong> 312 <?php endif; ?> 313 <?php _e( 'This is a file in your current parent theme.' ); ?> 314 </p> 315 </div> 316 <?php endif; ?> 320 <?php 321 if ( is_child_theme() && $theme->get_stylesheet() === get_template() ) : 322 $message = ( is_writable( $file ) ) ? '<strong>' . __( 'Caution:' ) . '</strong> ' : ''; 323 $message .= __( 'This is a file in your current parent theme.' ); 324 wp_admin_notice( 325 $message, 326 array( 327 'type' => 'warning', 328 'additional_classes' => array( 'inline' ), 329 ) 330 ); 331 endif; 332 ?> 317 333 </div> 318 <?php if ( is_writable( $file ) ) : ?> 334 <?php 335 if ( is_writable( $file ) ) { 336 ?> 319 337 <p class="submit"> 320 338 <?php submit_button( __( 'Update File' ), 'primary', 'submit', false ); ?> 321 339 <span class="spinner"></span> 322 340 </p> 323 <?php else : ?> 341 <?php 342 } else { 343 ?> 324 344 <p> 325 345 <?php … … 331 351 ?> 332 352 </p> 333 <?php endif; ?> 353 <?php 354 } 355 ?> 334 356 </div> 335 357 … … 343 365 <?php 344 366 $dismissed_pointers = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); 345 if ( ! in_array( 'theme_editor_notice', $dismissed_pointers, true ) ) :367 if ( ! in_array( 'theme_editor_notice', $dismissed_pointers, true ) ) { 346 368 // Get a back URL. 347 369 $referer = wp_get_referer(); … … 389 411 </div> 390 412 <?php 391 endif;// Editor warning notice.413 } // Editor warning notice. 392 414 393 415 require_once ABSPATH . 'wp-admin/admin-footer.php';
Note: See TracChangeset
for help on using the changeset viewer.