WordPress.org

Make WordPress Core

Ticket #31354: 31354.patch

File 31354.patch, 7.7 KB (added by anthakkar08, 7 years ago)

Patch for the issue

  • network/settings.php

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: /Applications/MAMP/htdocs/corewp/wp_411/trunk/wp-admin
    # This patch can be applied using context Tools: Patch action on respective folder.
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
    3939                        $( '#submit', this ).after( '<span class="spinner language-install-spinner" />' );
    4040                }
    4141        });
     42        jQuery('.option-label-chk').find('input[type="number"],select').attr({disabled:'disabled'});
     43        jQuery('.option-label-chk input[type="checkbox"]').click(function(){
     44            if(jQuery(this).is(':checked')){
     45                jQuery(this).parents('.option-label-chk').find('input[type="number"],select').removeAttr('disabled');
     46            }else{
     47                jQuery(this).parents('.option-label-chk').find('input[type="number"],select').attr({disabled:'disabled'});
     48            }
    4249});
     50        jQuery('.option-label-chk input[type="checkbox"]:checked').parents('.option-label-chk').find('input[type="number"],select').removeAttr('disabled');
     51});
    4352</script>
    4453<?php
    4554}
     
    293302                        <tr>
    294303                                <th scope="row"><?php _e( 'Site upload space' ) ?></th>
    295304                                <td>
    296                                 <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '</label><label><input name="blog_upload_space" type="number" min="0" style="width: 100px" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 100) ) . '" />' ); ?></label><br />
     305                                <div class="option-label-chk">   
     306                                <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '</label><label><input name="blog_upload_space" type="number" min="0" style="width: 100px" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 100) ) . '" />' ); ?></label></div>
    297307                                </td>
    298308                        </tr>
    299309
  • options-discussion.php

     
    1414$title = __('Discussion Settings');
    1515$parent_file = 'options-general.php';
    1616
    17 /**
    18  * Display JavaScript on the page.
    19  *
    20  * @since 4.2.0
    21  */
    2217function options_discussion_add_js() {
    2318?>
    24         <script>
    25         (function($){
    26                 var parent = $( '#show_avatars' ),
    27                         children = $( '.avatar-settings' );
    28                 parent.change(function(){
    29                         children.toggleClass( 'hide-if-js', ! this.checked );
     19<script type="text/javascript">
     20//<![CDATA[
     21    jQuery(document).ready(function(){
     22        jQuery('.option-label-chk').find('input[type="number"],select').attr({disabled:'disabled'});
     23        jQuery('.option-label-chk input[type="checkbox"]').click(function(){
     24            if(jQuery(this).is(':checked')){
     25                jQuery(this).parents('.option-label-chk').find('input[type="number"],select').removeAttr('disabled');
     26            }else{
     27                jQuery(this).parents('.option-label-chk').find('input[type="number"],select').attr({disabled:'disabled'});
     28            }
    3029                });
    31         })(jQuery);
     30        jQuery('.option-label-chk input[type="checkbox"]:checked').parents('.option-label-chk').find('input[type="number"],select').removeAttr('disabled');
     31    });
     32//]]>
    3233        </script>
    3334<?php
    3435}
    35 add_action( 'admin_print_footer_scripts', 'options_discussion_add_js' );
     36add_action('admin_head', 'options_discussion_add_js');
    3637
    3738get_current_screen()->add_help_tab( array(
    3839        'id'      => 'overview',
     
    8687<?php if ( !get_option( 'users_can_register' ) && is_multisite() ) echo ' ' . __( '(Signup has been disabled. Only members of this site can comment.)' ); ?>
    8788</label>
    8889<br />
    89 
     90<div class="option-label-chk">
    9091<label for="close_comments_for_old_posts">
    9192<input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked('1', get_option('close_comments_for_old_posts')); ?> />
    9293<?php printf( __('Automatically close comments on articles older than %s days'), '</label><label for="close_comments_days_old"><input name="close_comments_days_old" type="number" min="0" step="1" id="close_comments_days_old" value="' . esc_attr(get_option('close_comments_days_old')) . '" class="small-text" />'); ?>
    9394</label>
    94 <br />
     95</div>
     96<div class="option-label-chk">
    9597<label for="thread_comments">
    9698<input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked('1', get_option('thread_comments')); ?> />
    9799<?php
     
    115117printf( __('Enable threaded (nested) comments %s levels deep'), $thread_comments_depth );
    116118
    117119?></label>
    118 <br />
     120</div>
     121<div class="option-label-chk">
    119122<label for="page_comments">
    120123<input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked('1', get_option('page_comments')); ?> />
    121124<?php
     
    141144printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order );
    142145
    143146?></label>
     147</div>
    144148</fieldset></td>
    145149</tr>
    146150<tr>
     
    192196
    193197<p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites. Here you can enable the display of avatars for people who comment on your site.'); ?></p>
    194198
    195 <?php
    196 // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that?
     199<?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?>
    197200
    198 $show_avatars = get_option( 'show_avatars' );
    199 ?>
    200 
    201201<table class="form-table">
    202202<tr>
    203203<th scope="row"><?php _e('Avatar Display'); ?></th>
    204204<td><fieldset><legend class="screen-reader-text"><span><?php _e('Avatar Display'); ?></span></legend>
    205205        <label for="show_avatars">
    206                 <input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( $show_avatars, 1 ); ?> />
     206                <input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( get_option('show_avatars'), 1 ); ?> />
    207207                <?php _e( 'Show Avatars' ); ?>
    208208        </label>
    209209</fieldset></td>
    210210</tr>
    211 <tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>">
     211<tr>
    212212<th scope="row"><?php _e('Maximum Rating'); ?></th>
    213213<td><fieldset><legend class="screen-reader-text"><span><?php _e('Maximum Rating'); ?></span></legend>
    214214
     
    231231
    232232</fieldset></td>
    233233</tr>
    234 <tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>">
     234<tr>
    235235<th scope="row"><?php _e('Default Avatar'); ?></th>
    236236<td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e('Default Avatar'); ?></span></legend>
    237237
     
    263263        $default = 'mystery';
    264264$size = 32;
    265265$avatar_list = '';
    266 
    267 // Force avatars on to display these choices
    268 add_filter( 'pre_option_show_avatars', '__return_true', 100 );
    269 
    270266foreach ( $avatar_defaults as $default_key => $default_name ) {
    271267        $selected = ($default == $default_key) ? 'checked="checked" ' : '';
    272268        $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key) . "' {$selected}/> ";
     
    277273        $avatar_list .= ' ' . $default_name . '</label>';
    278274        $avatar_list .= '<br />';
    279275}
    280 
    281 remove_filter( 'pre_option_show_avatars', '__return_true', 100 );
    282 
    283276/**
    284277 * Filter the HTML output of the default avatar list.
    285278 *