Ticket #18285: 16413.class-wp-settings-page.diff
| File 16413.class-wp-settings-page.diff, 8.5 KB (added by , 15 years ago) |
|---|
-
wp-admin/includes/template.php
1336 1336 echo $output; 1337 1337 } 1338 1338 1339 class WP_Settings_Page { 1340 protected $settings_group; 1341 1342 function add_section( $section_id, $section_title, $fields = array() ) { 1343 if ( method_exists( $this, 'section_' . $section_id ) ) 1344 $callback = array( $this, 'section_' . $section_id ); 1345 else 1346 $callback = '__return_false'; 1347 1348 add_settings_section( $section_id, $section_title, $callback, $this->settings_group ); 1349 1350 foreach ( $fields as $id => $title ) { 1351 $this->add_field( $id, $title, $section_id ); 1352 } 1353 } 1354 1355 function add_field( $id, $title, $section ) { 1356 add_settings_field( $id, $title, array( $this, 'field_' . $id ), $this->settings_group, $section ); 1357 } 1358 } 1359 1339 1360 /** 1340 1361 * {@internal Missing Short Description}} 1341 1362 * -
wp-admin/options-media.php
27 27 28 28 include('./admin-header.php'); 29 29 30 ?> 30 class WP_Settings_Media extends WP_Settings_Page { 31 protected $settings_group = 'media'; 31 32 32 <div class="wrap"> 33 <?php screen_icon(); ?> 34 <h2><?php echo esc_html( $title ); ?></h2> 33 function __construct() { 34 $this->add_section( 'media', __( 'Image sizes' ), array( 35 'thumbnail_size' => __( 'Thumbnail size' ), 36 'medium_size' => __( 'Medium size' ), 37 'large_size' => __( 'Large size' ), 38 ) ); 35 39 36 <form action="options.php" method="post"> 37 <?php settings_fields('media'); ?> 40 $this->add_section( 'embeds', __( 'Embeds' ), array( 41 'auto_embeds' => __( 'Auto-embeds' ), 42 'maximum_embed_size' => __( 'Maximum embed size' ), 43 ) ); 38 44 39 <h3><?php _e('Image sizes') ?></h3> 40 <p><?php _e('The sizes listed below determine the maximum dimensions in pixels to use when inserting an image into the body of a post.'); ?></p> 45 if ( !is_multisite() ) { 46 $this->add_section( 'uploads', __( 'Uploading files' ), array( 47 'upload_path' => __( 'Store uploads in this folder' ), 48 'upload_url_path' => __( 'Full URL path to files' ), 49 'upload_folders' => __( 'Uploads organization' ), 50 ) ); 51 } 52 } 41 53 42 <table class="form-table"> 43 <tr valign="top"> 44 <th scope="row"><?php _e('Thumbnail size') ?></th> 45 <td> 54 55 function section_media() { 56 ?> 57 <p><?php _e( 'The sizes listed below determine the maximum dimensions in pixels to use when inserting an image into the body of a post.' ); ?></p> 58 <?php 59 } 60 61 function field_thumbnail_size() { 62 ?> 46 63 <label for="thumbnail_size_w"><?php _e('Width'); ?></label> 47 64 <input name="thumbnail_size_w" type="text" id="thumbnail_size_w" value="<?php form_option('thumbnail_size_w'); ?>" class="small-text" /> 48 65 <label for="thumbnail_size_h"><?php _e('Height'); ?></label> 49 66 <input name="thumbnail_size_h" type="text" id="thumbnail_size_h" value="<?php form_option('thumbnail_size_h'); ?>" class="small-text" /><br /> 50 67 <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/> 51 68 <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label> 52 < /td>53 </tr> 69 <?php 70 } 54 71 55 <tr valign="top"> 56 <th scope="row"><?php _e('Medium size') ?></th>57 < td><fieldset><legend class="screen-reader-text"><span><?php _e('Medium size'); ?></span></legend>72 function field_medium_size() { 73 ?> 74 <fieldset><legend class="screen-reader-text"><span><?php _e('Medium size'); ?></span></legend> 58 75 <label for="medium_size_w"><?php _e('Max Width'); ?></label> 59 76 <input name="medium_size_w" type="text" id="medium_size_w" value="<?php form_option('medium_size_w'); ?>" class="small-text" /> 60 77 <label for="medium_size_h"><?php _e('Max Height'); ?></label> 61 78 <input name="medium_size_h" type="text" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" class="small-text" /> 62 </fieldset></td> 63 </tr> 79 </fieldset> 80 <?php 81 } 64 82 65 <tr valign="top"> 66 <th scope="row"><?php _e('Large size') ?></th>67 < td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size'); ?></span></legend>83 function field_large_size() { 84 ?> 85 <fieldset><legend class="screen-reader-text"><span><?php _e('Large size'); ?></span></legend> 68 86 <label for="large_size_w"><?php _e('Max Width'); ?></label> 69 87 <input name="large_size_w" type="text" id="large_size_w" value="<?php form_option('large_size_w'); ?>" class="small-text" /> 70 88 <label for="large_size_h"><?php _e('Max Height'); ?></label> 71 89 <input name="large_size_h" type="text" id="large_size_h" value="<?php form_option('large_size_h'); ?>" class="small-text" /> 72 </fieldset></td> 73 </tr> 90 </fieldset> 91 <?php 92 } 74 93 75 <?php do_settings_fields('media', 'default'); ?> 76 </table> 77 78 <h3><?php _e('Embeds') ?></h3> 79 80 <table class="form-table"> 81 82 <tr valign="top"> 83 <th scope="row"><?php _e('Auto-embeds'); ?></th> 84 <td><fieldset><legend class="screen-reader-text"><span><?php _e('When possible, embed the media content from a URL directly onto the page. For example: links to Flickr and YouTube.'); ?></span></legend> 94 function field_auto_embeds() { 95 ?> 96 <fieldset><legend class="screen-reader-text"><span><?php _e('When possible, embed the media content from a URL directly onto the page. For example: links to Flickr and YouTube.'); ?></span></legend> 85 97 <label for="embed_autourls"><input name="embed_autourls" type="checkbox" id="embed_autourls" value="1" <?php checked( '1', get_option('embed_autourls') ); ?>/> <?php _e('When possible, embed the media content from a URL directly onto the page. For example: links to Flickr and YouTube.'); ?></label> 86 </fieldset></td> 87 </tr> 98 </fieldset> 99 <?php 100 } 88 101 89 <tr valign="top"> 90 <th scope="row"><?php _e('Maximum embed size') ?></th> 91 <td> 102 function field_maximum_embed_size() { 103 ?> 92 104 <label for="embed_size_w"><?php _e('Width'); ?></label> 93 105 <input name="embed_size_w" type="text" id="embed_size_w" value="<?php form_option('embed_size_w'); ?>" class="small-text" /> 94 106 <label for="embed_size_h"><?php _e('Height'); ?></label> 95 107 <input name="embed_size_h" type="text" id="embed_size_h" value="<?php form_option('embed_size_h'); ?>" class="small-text" /> 96 108 <?php if ( !empty($content_width) ) echo '<br />' . __("If the width value is left blank, embeds will default to the max width of your theme."); ?> 97 < /td>98 </tr> 109 <?php 110 } 99 111 100 <?php do_settings_fields('media', 'embeds'); ?> 101 </table> 102 103 <?php if ( !is_multisite() ) : ?> 104 <h3><?php _e('Uploading Files'); ?></h3> 105 <table class="form-table"> 106 <tr valign="top"> 107 <th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th> 108 <td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" /> 112 function field_upload_path() { 113 ?> 114 <input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" /> 109 115 <span class="description"><?php _e('Default is <code>wp-content/uploads</code>'); ?></span> 110 < /td>111 </tr> 116 <?php 117 } 112 118 113 <tr valign="top"> 114 <th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>115 < td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr( get_option('upload_url_path')); ?>" class="regular-text code" />119 function field_upload_url_path() { 120 ?> 121 <input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr( get_option('upload_url_path')); ?>" class="regular-text code" /> 116 122 <span class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></span> 117 < /td>118 </tr> 123 <?php 124 } 119 125 120 <tr> 121 <th scope="row" colspan="2" class="th-full">126 function field_upload_folders() { 127 ?> 122 128 <label for="uploads_use_yearmonth_folders"> 123 129 <input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> /> 124 130 <?php _e('Organize my uploads into month- and year-based folders'); ?> 125 < /label>126 </th> 127 </tr> 131 <?php 132 } 133 } 128 134 129 <?php do_settings_fields('media', 'uploads'); ?> 130 </table> 131 <?php endif; ?> 135 $wp_settings_page = new WP_Settings_Media; 136 ?> 132 137 138 <div class="wrap"> 139 <?php screen_icon(); ?> 140 <h2><?php echo esc_html( $title ); ?></h2> 141 142 <form action="options.php" method="post"> 143 <?php settings_fields('media'); ?> 133 144 <?php do_settings_sections('media'); ?> 134 145 135 146 <?php submit_button(); ?> 136 147 137 148 </form> 138 139 149 </div> 140 150 141 151 <?php include('./admin-footer.php'); ?>
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)