wp/wp-admin/includes/options.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    34 function options_general_add_js() {
    34 function options_general_add_js() {
    35 	?>
    35 	?>
    36 <script type="text/javascript">
    36 <script type="text/javascript">
    37 	jQuery( function($) {
    37 	jQuery( function($) {
    38 		var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(),
    38 		var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(),
       
    39 			$siteIconPreview = $('#site-icon-preview-site-title'),
    39 			homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' );
    40 			homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' );
    40 
    41 
    41 		$( '#blogname' ).on( 'input', function() {
    42 		$( '#blogname' ).on( 'input', function() {
    42 			var title = $.trim( $( this ).val() ) || homeURL;
    43 			var title = $.trim( $( this ).val() ) || homeURL;
    43 
    44 
    45 			if ( 40 < title.length ) {
    46 			if ( 40 < title.length ) {
    46 				title = title.substring( 0, 40 ) + '\u2026';
    47 				title = title.substring( 0, 40 ) + '\u2026';
    47 			}
    48 			}
    48 
    49 
    49 			$siteName.text( title );
    50 			$siteName.text( title );
       
    51 			$siteIconPreview.text( title );
    50 		});
    52 		});
    51 
    53 
    52 		$( 'input[name="date_format"]' ).on( 'click', function() {
    54 		$( 'input[name="date_format"]' ).on( 'click', function() {
    53 			if ( 'date_format_custom_radio' !== $(this).attr( 'id' ) )
    55 			if ( 'date_format_custom_radio' !== $(this).attr( 'id' ) )
    54 				$( 'input[name="date_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
    56 				$( 'input[name="date_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
    88 			}, 500 ) );
    90 			}, 500 ) );
    89 		} );
    91 		} );
    90 
    92 
    91 		var languageSelect = $( '#WPLANG' );
    93 		var languageSelect = $( '#WPLANG' );
    92 		$( 'form' ).on( 'submit', function() {
    94 		$( 'form' ).on( 'submit', function() {
    93 			// Don't show a spinner for English and installed languages,
    95 			/*
    94 			// as there is nothing to download.
    96 			 * Don't show a spinner for English and installed languages,
       
    97 			 * as there is nothing to download.
       
    98 			 */
    95 			if ( ! languageSelect.find( 'option:selected' ).data( 'installed' ) ) {
    99 			if ( ! languageSelect.find( 'option:selected' ).data( 'installed' ) ) {
    96 				$( '#submit', this ).after( '<span class="spinner language-install-spinner is-active" />' );
   100 				$( '#submit', this ).after( '<span class="spinner language-install-spinner is-active" />' );
    97 			}
   101 			}
    98 		});
   102 		});
    99 	} );
   103 	} );
   128  *
   132  *
   129  * @since 3.5.0
   133  * @since 3.5.0
   130  */
   134  */
   131 function options_reading_blog_charset() {
   135 function options_reading_blog_charset() {
   132 	echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />';
   136 	echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />';
   133 	echo '<p class="description">' . __( 'The <a href="https://wordpress.org/support/article/glossary/#character-set">character encoding</a> of your site (UTF-8 is recommended)' ) . '</p>';
   137 	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>';
   134 }
   138 }