Ticket #29872: 29872.4.diff
File 29872.4.diff, 5.6 KB (added by , 9 years ago) |
---|
-
src/wp-admin/css/forms.css
diff --git src/wp-admin/css/forms.css src/wp-admin/css/forms.css index 7cc0801..33c73db 100644
table.form-table td .updated p { 925 925 vertical-align: middle; 926 926 } 927 927 928 .form-table.permalink-structure .available-shortcode-tags li { 929 float: left; 930 margin-right: 5px; 931 } 932 933 .form-table.permalink-structure .available-shortcode-tags button { 934 background: none; 935 border: 1px solid transparent; 936 padding: 0; 937 outline: none; 938 } 939 940 .form-table.permalink-structure .available-shortcode-tags button:focus { 941 border-color: #5b9dd9; 942 -webkit-box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 ); 943 box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 ); 944 } 945 946 .form-table.permalink-structure .available-shortcode-tags code { 947 margin: 0; 948 cursor: pointer; 949 } 950 928 951 /*------------------------------------------------------------------------------ 929 952 21.0 - Network Admin 930 953 ------------------------------------------------------------------------------*/ -
src/wp-admin/js/common.js
diff --git src/wp-admin/js/common.js src/wp-admin/js/common.js index 43a8f09..95e1123 100644
$('.contextual-help-tabs').delegate('a', 'click', function(e) { 175 175 panel.addClass('active').show(); 176 176 }); 177 177 178 /** 179 * Update custom permalink structure via buttons. 180 */ 181 182 var permalinkStructureFocused = false; 183 184 // See if the permalink structure input field has had focus at least one 185 $( '#permalink_structure' ).on( 'focus', function( event ) { 186 permalinkStructureFocused = true; 187 $( this ).off( event ); 188 }) 189 190 $( '.form-table.permalink-structure .available-shortcode-tags button' ).on( 'click', function() { 191 var $permalinkStructure = $( '#permalink_structure' ), 192 permalinkStructureValue = $permalinkStructure.val(), 193 selectionStart = $permalinkStructure[ 0 ].selectionStart, 194 selectionEnd = $permalinkStructure[ 0 ].selectionEnd, 195 textToAppend = $( this ).find( 'code' ).text(), 196 textToAnnounce = $( this ).attr( 'data-added' ); 197 198 // Do not insert structure tag if already part of the structure. 199 if ( -1 !== permalinkStructureValue.indexOf( textToAppend ) ) { 200 return; 201 } 202 203 // Input field never had focus, move selection to end of input. 204 if ( ! permalinkStructureFocused && 0 === selectionStart && 0 === selectionEnd ) { 205 selectionStart = selectionEnd = permalinkStructureValue.length; 206 } 207 208 $( '#custom_selection' ).prop( 'checked', true ); 209 210 // Prepend and append slashes if necessary. 211 if ( '/' !== permalinkStructureValue.substr( 0, selectionStart ).substr( -1 ) ) { 212 textToAppend = '/' + textToAppend; 213 } 214 215 if ( '/' !== permalinkStructureValue.substr( selectionEnd, 1 ) ) { 216 textToAppend = textToAppend + '/'; 217 } 218 219 // Insert structure tag at the specified position. 220 $permalinkStructure.val( permalinkStructureValue.substr( 0, selectionStart ) + textToAppend + permalinkStructureValue.substr( selectionEnd ) ); 221 222 // Announce change to screen readers. 223 $( '#custom_selection_updated' ).text( textToAnnounce ); 224 } ) 225 178 226 $document.ready( function() { 179 227 var checks, first, last, checked, sliced, mobileEvent, transitionTimeout, focusedRowActions, 180 228 lastClicked = false, -
src/wp-admin/options-permalink.php
diff --git src/wp-admin/options-permalink.php src/wp-admin/options-permalink.php index 95c1a3e..935e8d7 100644
$structures = array( 206 206 <td> 207 207 <code><?php echo get_option('home') . $blog_prefix; ?></code> 208 208 <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" /> 209 <div class="available-shortcode-tags hide-if-no-js"> 210 <div id="custom_selection_updated" aria-live="assertive" class="screen-reader-text"></div> 211 <?php 212 $available_tags = array( 213 '%year%' => __( 'The year of the post, four digits, for example 2004' ), 214 '%monthnum%' => __( 'Month of the year, for example 05' ), 215 '%day%' => __( 'Day of the month, for example 28' ), 216 '%hour%' => __( 'Hour of the day, for example 15' ), 217 '%minute%' => __( 'Minute of the hour, for example 43' ), 218 '%second%' => __( 'Second of the minute, for example 33' ), 219 '%post_id%' => __( 'The unique ID of the post, for example 423' ), 220 '%postname%' => __( 'The sanitized post title (slug)' ), 221 '%category%' => __( 'Category slug. Nested sub-categories appear as nested directories in the URI.' ), 222 '%author%' => __( 'A sanitized version of the author name.' ), 223 ); 224 225 /** 226 * Filters the list of available permalink structure tags on the Permalinks settings page. 227 * 228 * @since 4.7.0 229 * 230 * @param array $available_tags A key => value pair of available permalink structure tags. 231 */ 232 $available_tags = apply_filters( 'available_permalink_structure_tags', $available_tags ); 233 234 if ( ! empty( $available_tags ) ) : 235 ?> 236 <p><?php _e( 'Available tags:' ); ?></p> 237 <ul> 238 <?php 239 foreach ( $available_tags as $tag => $explanation ) { 240 $notification = esc_attr( sprintf( __( '%s added to permalink structure' ), $tag ) ); 241 ?> 242 <li> 243 <button type="button" data-added="<?php echo esc_attr( sprintf( __( '%s added to permalink structure' ), $tag ) ); ?>"> 244 <code><?php echo $tag; ?></code><span class="screen-reader-text"><?php echo esc_html( $explanation ); ?></span> 245 </button> 246 </li> 247 <?php 248 } 249 ?> 250 </ul> 251 <?php endif; ?> 252 </div> 209 253 </td> 210 254 </tr> 211 255 </table>