| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * WordPress Options Administration API. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 * @since 4.4.0 8 */ 9 10 /** 11 * Output JavaScript to toggle display of additional settings if avatars are disabled. 12 * 13 * @since 4.2.0 14 */ 15 function options_discussion_add_js() { 16 ?> 17 <script> 18 (function($){ 19 var parent = $( '#show_avatars' ), 20 children = $( '.avatar-settings' ); 21 parent.on( 'change', function(){ 22 children.toggleClass( 'hide-if-js', ! this.checked ); 23 }); 24 })(jQuery); 25 </script> 26 <?php 27 } 28 29 /** 30 * Display JavaScript on the page. 31 * 32 * @since 3.5.0 33 */ 34 function options_general_add_js() { 35 ?> 36 <script> 37 jQuery( function($) { 38 var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(), 39 $siteIconPreview = $('#site-icon-preview-site-title'), 40 homeURL = ( <?php echo wp_json_encode( get_home_url(), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' ); 41 42 $( '#blogname' ).on( 'input', function() { 43 var title = $.trim( $( this ).val() ) || homeURL, 44 $siteIcon = $siteName.children(); 45 46 // Truncate to 40 characters. 47 if ( 40 < title.length ) { 48 title = title.substring( 0, 40 ) + '\u2026'; 49 } 50 51 $siteName.text( title ).prepend( $siteIcon ); 52 $siteIconPreview.text( title ); 53 }); 54 55 $( 'input[name="date_format"]' ).on( 'click', function() { 56 if ( 'date_format_custom_radio' !== $(this).attr( 'id' ) ) 57 $( 'input[name="date_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() ); 58 }); 59 60 $( 'input[name="date_format_custom"]' ).on( 'click input', function() { 61 $( '#date_format_custom_radio' ).prop( 'checked', true ); 62 }); 63 64 $( 'input[name="time_format"]' ).on( 'click', function() { 65 if ( 'time_format_custom_radio' !== $(this).attr( 'id' ) ) 66 $( 'input[name="time_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() ); 67 }); 68 69 $( 'input[name="time_format_custom"]' ).on( 'click input', function() { 70 $( '#time_format_custom_radio' ).prop( 'checked', true ); 71 }); 72 73 $( 'input[name="date_format_custom"], input[name="time_format_custom"]' ).on( 'input', function() { 74 var format = $( this ), 75 fieldset = format.closest( 'fieldset' ), 76 example = fieldset.find( '.example' ), 77 spinner = fieldset.find( '.spinner' ); 78 79 // Debounce the event callback while users are typing. 80 clearTimeout( $.data( this, 'timer' ) ); 81 $( this ).data( 'timer', setTimeout( function() { 82 // If custom date is not empty. 83 if ( format.val() ) { 84 spinner.addClass( 'is-active' ); 85 86 $.post( ajaxurl, { 87 action: 'date_format_custom' === format.attr( 'name' ) ? 'date_format' : 'time_format', 88 date : format.val() 89 }, function( d ) { spinner.removeClass( 'is-active' ); example.text( d ); } ); 90 } 91 }, 500 ) ); 92 } ); 93 94 var languageSelect = $( '#WPLANG' ); 95 $( 'form' ).on( 'submit', function() { 96 /* 97 * Don't show a spinner for English and installed languages, 98 * as there is nothing to download. 99 */ 100 if ( ! languageSelect.find( 'option:selected' ).data( 'installed' ) ) { 101 $( '#submit', this ).after( '<span class="spinner language-install-spinner is-active" />' ); 102 } 103 }); 104 } ); 105 </script> 106 <?php 107 } 108 109 /** 110 * Display JavaScript on the page. 111 * 112 * @since 3.5.0 113 */ 114 function options_reading_add_js() { 115 ?> 116 <script> 117 jQuery( function($) { 118 var section = $('#front-static-pages'), 119 staticPage = section.find('input:radio[value="page"]'), 120 selects = section.find('select'), 121 check_disabled = function(){ 122 selects.prop( 'disabled', ! staticPage.prop('checked') ); 123 }; 124 check_disabled(); 125 section.find( 'input:radio' ).on( 'change', check_disabled ); 126 } ); 127 </script> 128 <?php 129 } 130 131 /** 132 * Render the site charset setting. 133 * 134 * @since 3.5.0 135 */ 136 function options_reading_blog_charset() { 137 echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />'; 138 echo '<p class="description">' . __( 'The <a href="https://wordpress.org/documentation/article/wordpress-glossary/#character-set">character encoding</a> of your site (UTF-8 is recommended)' ) . '</p>'; 139 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sun Jul 19 08:20:17 2026 | Cross-referenced by PHPXref |