wp/wp-admin/options-general.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
   122 	// Handle alt text for site icon on page load.
   122 	// Handle alt text for site icon on page load.
   123 	$site_icon_id           = (int) get_option( 'site_icon' );
   123 	$site_icon_id           = (int) get_option( 'site_icon' );
   124 	$app_icon_alt_value     = '';
   124 	$app_icon_alt_value     = '';
   125 	$browser_icon_alt_value = '';
   125 	$browser_icon_alt_value = '';
   126 
   126 
       
   127 	$site_icon_url = get_site_icon_url();
       
   128 
   127 	if ( $site_icon_id ) {
   129 	if ( $site_icon_id ) {
   128 		$img_alt            = get_post_meta( $site_icon_id, '_wp_attachment_image_alt', true );
   130 		$img_alt            = get_post_meta( $site_icon_id, '_wp_attachment_image_alt', true );
   129 		$filename           = wp_basename( get_site_icon_url() );
   131 		$filename           = wp_basename( $site_icon_url );
   130 		$app_icon_alt_value = sprintf(
   132 		$app_icon_alt_value = sprintf(
   131 			/* translators: %s: The selected image filename. */
   133 			/* translators: %s: The selected image filename. */
   132 			__( 'App icon preview: The current image has no alternative text. The file name is: %s' ),
   134 			__( 'App icon preview: The current image has no alternative text. The file name is: %s' ),
   133 			$filename
   135 			$filename
   134 		);
   136 		);
   153 			);
   155 			);
   154 		}
   156 		}
   155 	}
   157 	}
   156 	?>
   158 	?>
   157 
   159 
   158 
   160 	<style>
   159 	<div id="site-icon-preview" class="site-icon-preview wp-clearfix settings-page-preview <?php echo esc_attr( $classes_for_wrapper ); ?>">
   161 	:root {
   160 		<div class="favicon-preview">
   162 		--site-icon-url: url( '<?php echo esc_url( $site_icon_url ); ?>' );
   161 			<img src="<?php echo esc_url( admin_url( 'images/' . ( is_rtl() ? 'browser-rtl.png' : 'browser.png' ) ) ); ?>" class="browser-preview" width="182" alt="">
   163 	}
   162 			<div class="favicon">
   164 	</style>
   163 				<img id="browser-icon-preview" src="<?php site_icon_url(); ?>" alt="<?php echo esc_attr( $browser_icon_alt_value ); ?>">
   165 
       
   166 	<div id="site-icon-preview" class="site-icon-preview settings <?php echo esc_attr( $classes_for_wrapper ); ?>">
       
   167 		<div class="direction-wrap">
       
   168 			<img id="app-icon-preview" src="<?php echo esc_url( $site_icon_url ); ?>" class="app-icon-preview" alt="<?php echo esc_attr( $app_icon_alt_value ); ?>" />
       
   169 			<div class="site-icon-preview-browser">
       
   170 				<svg role="img" aria-hidden="true" fill="none" xmlns="http://www.w3.org/2000/svg" class="browser-buttons"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 20a6 6 0 1 1 12 0 6 6 0 0 1-12 0Zm18 0a6 6 0 1 1 12 0 6 6 0 0 1-12 0Zm24-6a6 6 0 1 0 0 12 6 6 0 0 0 0-12Z" /></svg>
       
   171 				<div class="site-icon-preview-tab">
       
   172 					<img id="browser-icon-preview" src="<?php echo esc_url( $site_icon_url ); ?>" class="browser-icon-preview" alt="<?php echo esc_attr( $browser_icon_alt_value ); ?>" />
       
   173 					<div class="site-icon-preview-site-title" id="site-icon-preview-site-title" aria-hidden="true"><?php bloginfo( 'name' ); ?></div>
       
   174 						<svg role="img" aria-hidden="true" fill="none" xmlns="http://www.w3.org/2000/svg" class="close-button">
       
   175 							<path d="M12 13.0607L15.7123 16.773L16.773 15.7123L13.0607 12L16.773 8.28772L15.7123 7.22706L12 10.9394L8.28771 7.22705L7.22705 8.28771L10.9394 12L7.22706 15.7123L8.28772 16.773L12 13.0607Z" />
       
   176 						</svg>
       
   177 					</div>
       
   178 				</div>
   164 			</div>
   179 			</div>
   165 			<span id="site-icon-preview-site-title" class="browser-title" aria-hidden="true"><?php bloginfo( 'name' ); ?></span>
       
   166 		</div>
   180 		</div>
   167 		<img id="app-icon-preview" class="app-icon-preview" src="<?php site_icon_url(); ?>" alt="<?php echo esc_attr( $app_icon_alt_value ); ?>">
       
   168 	</div>
   181 	</div>
   169 
   182 
   170 	<input type="hidden" name="site_icon" id="site_icon_hidden_field" value="<?php form_option( 'site_icon' ); ?>" />
   183 	<input type="hidden" name="site_icon" id="site_icon_hidden_field" value="<?php form_option( 'site_icon' ); ?>" />
   171 	<div class="action-buttons">
   184 	<div class="site-icon-action-buttons">
   172 		<button type="button"
   185 		<button type="button"
   173 			id="choose-from-library-button"
   186 			id="choose-from-library-button"
   174 			type="button"
       
   175 			class="<?php echo esc_attr( $classes_for_button ); ?>"
   187 			class="<?php echo esc_attr( $classes_for_button ); ?>"
   176 			data-alt-classes="<?php echo esc_attr( $classes_for_button_on_change ); ?>"
   188 			data-alt-classes="<?php echo esc_attr( $classes_for_button_on_change ); ?>"
   177 			data-size="512"
   189 			data-size="512"
   178 			data-choose-text="<?php esc_attr_e( 'Choose a Site Icon' ); ?>"
   190 			data-choose-text="<?php esc_attr_e( 'Choose a Site Icon' ); ?>"
   179 			data-update-text="<?php esc_attr_e( 'Change Site Icon' ); ?>"
   191 			data-update-text="<?php esc_attr_e( 'Change Site Icon' ); ?>"
   188 			<?php endif; ?>
   200 			<?php endif; ?>
   189 		</button>
   201 		</button>
   190 		<button
   202 		<button
   191 			id="js-remove-site-icon"
   203 			id="js-remove-site-icon"
   192 			type="button"
   204 			type="button"
   193 			<?php echo has_site_icon() ? 'class="button button-secondary reset"' : 'class="button button-secondary reset hidden"'; ?>
   205 			<?php echo has_site_icon() ? 'class="button button-secondary reset remove-site-icon"' : 'class="button button-secondary reset hidden"'; ?>
   194 		>
   206 		>
   195 			<?php _e( 'Remove Site Icon' ); ?>
   207 			<?php _e( 'Remove Site Icon' ); ?>
   196 		</button>
   208 		</button>
   197 	</div>
   209 	</div>
   198 
   210 
   199 	<p class="description">
   211 	<p class="description">
   200 		<?php
   212 		<?php
   201 			/* translators: %s: Site Icon size in pixels. */
   213 			printf(
   202 			printf( __( 'The Site Icon is what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. It should be square and at least %s pixels.' ), '<code>512 &times; 512</code>' );
   214 				/* translators: 1: pixel value for icon size. 2: pixel value for icon size. */
       
   215 				__( 'The Site Icon is what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. It should be square and at least <code>%1$s by %2$s</code> pixels.' ),
       
   216 				512,
       
   217 				512
       
   218 			);
   203 		?>
   219 		?>
   204 	</p>
   220 	</p>
   205 
   221 
   206 </td>
   222 </td>
   207 </tr>
   223 </tr>
   457 <?php
   473 <?php
   458 	/**
   474 	/**
   459 	 * Filters the default date formats.
   475 	 * Filters the default date formats.
   460 	 *
   476 	 *
   461 	 * @since 2.7.0
   477 	 * @since 2.7.0
   462 	 * @since 4.0.0 Added ISO date standard YYYY-MM-DD format.
   478 	 * @since 4.0.0 Replaced the `Y/m/d` format with `Y-m-d` (ISO date standard YYYY-MM-DD).
       
   479 	 * @since 6.8.0 Added the `d.m.Y` format.
   463 	 *
   480 	 *
   464 	 * @param string[] $default_date_formats Array of default date formats.
   481 	 * @param string[] $default_date_formats Array of default date formats.
   465 	 */
   482 	 */
   466 	$date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) );
   483 	$date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y', 'd.m.Y' ) ) );
   467 
   484 
   468 	$custom = true;
   485 	$custom = true;
   469 
   486 
   470 foreach ( $date_formats as $format ) {
   487 foreach ( $date_formats as $format ) {
   471 	echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'";
   488 	echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'";