Make WordPress Core

Ticket #29872: 29872.6.diff

File 29872.6.diff, 3.8 KB (added by swissspidy, 8 years ago)
  • src/wp-admin/includes/deprecated.php

    diff --git src/wp-admin/includes/deprecated.php src/wp-admin/includes/deprecated.php
    index b032018f28..a95214975b 100644
    function post_form_autocomplete_off() { 
    14901490                echo ' autocomplete="off"';
    14911491        }
    14921492}
     1493
     1494/**
     1495 * Display JavaScript on the page.
     1496 *
     1497 * @since 3.5.0
     1498 * @deprecated 4.9.0
     1499 */
     1500function options_permalink_add_js() {
     1501        ?>
     1502        <script type="text/javascript">
     1503                jQuery(document).ready(function() {
     1504                        jQuery('.permalink-structure input:radio').change(function() {
     1505                                if ( 'custom' == this.value )
     1506                                        return;
     1507                                jQuery('#permalink_structure').val( this.value );
     1508                        });
     1509                        jQuery( '#permalink_structure' ).on( 'click input', function() {
     1510                                jQuery( '#custom_selection' ).prop( 'checked', true );
     1511                        });
     1512                });
     1513        </script>
     1514        <?php
     1515}
  • src/wp-admin/includes/options.php

    diff --git src/wp-admin/includes/options.php src/wp-admin/includes/options.php
    index 6b8114d571..053d5eec64 100644
    function options_general_add_js() { 
    9191 *
    9292 * @since 3.5.0
    9393 */
    94 function options_permalink_add_js() {
    95         ?>
    96 <script type="text/javascript">
    97 jQuery(document).ready(function() {
    98         jQuery('.permalink-structure input:radio').change(function() {
    99                 if ( 'custom' == this.value )
    100                         return;
    101                 jQuery('#permalink_structure').val( this.value );
    102         });
    103         jQuery( '#permalink_structure' ).on( 'click input', function() {
    104                 jQuery( '#custom_selection' ).prop( 'checked', true );
    105         });
    106 });
    107 </script>
    108 <?php
    109 }
    110 
    111 /**
    112  * Display JavaScript on the page.
    113  *
    114  * @since 3.5.0
    115  */
    11694function options_reading_add_js() {
    11795?>
    11896<script type="text/javascript">
  • src/wp-admin/js/common.js

    diff --git src/wp-admin/js/common.js src/wp-admin/js/common.js
    index 87a478a13f..94344d5602 100644
    $('.contextual-help-tabs').delegate('a', 'click', function(e) { 
    181181
    182182var permalinkStructureFocused = false,
    183183    $permalinkStructure       = $( '#permalink_structure' ),
     184    $permalinkStructureInputs = $( '.permalink-structure input:radio' ),
     185    $permalinkCustomSelection = $( '#custom_selection' ),
    184186    $availableStructureTags   = $( '.form-table.permalink-structure .available-structure-tags button' );
    185187
     188// Change permalink structure input when selecting one of the common structures.
     189$permalinkStructureInputs.on( 'change', function() {
     190        if ( 'custom' === this.value ) {
     191                return;
     192        }
     193
     194        $permalinkStructure.val( this.value );
     195
     196        // Update button states after selection.
     197        $availableStructureTags.each( function() {
     198                changeStructureTagButtonState( $( this ) );
     199        } );
     200} );
     201
     202$permalinkStructure.on( 'click input', function() {
     203        $permalinkCustomSelection.prop( 'checked', true );
     204} );
     205
    186206// Check if the permalink structure input field has had focus at least once.
    187207$permalinkStructure.on( 'focus', function( event ) {
    188208        permalinkStructureFocused = true;
    $availableStructureTags.on( 'click', function() { 
    249269                selectionStart = selectionEnd = permalinkStructureValue.length;
    250270        }
    251271
    252         $( '#custom_selection' ).prop( 'checked', true );
     272        $permalinkCustomSelection.prop( 'checked', true );
    253273
    254274        // Prepend and append slashes if necessary.
    255275        if ( '/' !== permalinkStructureValue.substr( 0, selectionStart ).substr( -1 ) ) {
  • src/wp-admin/options-permalink.php

    diff --git src/wp-admin/options-permalink.php src/wp-admin/options-permalink.php
    index c7193f96a6..c97c639546 100644
    get_current_screen()->set_help_sidebar( 
    4646        '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
    4747);
    4848
    49 add_filter('admin_head', 'options_permalink_add_js');
    50 
    5149$home_path = get_home_path();
    5250$iis7_permalinks = iis7_supports_permalinks();
    5351$permalink_structure = get_option( 'permalink_structure' );