wp/wp-admin/includes/dashboard.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
   240 function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
   240 function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
   241 	echo '<form method="post" class="dashboard-widget-control-form wp-clearfix">';
   241 	echo '<form method="post" class="dashboard-widget-control-form wp-clearfix">';
   242 	wp_dashboard_trigger_widget_control( $meta_box['id'] );
   242 	wp_dashboard_trigger_widget_control( $meta_box['id'] );
   243 	wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' );
   243 	wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' );
   244 	echo '<input type="hidden" name="widget_id" value="' . esc_attr( $meta_box['id'] ) . '" />';
   244 	echo '<input type="hidden" name="widget_id" value="' . esc_attr( $meta_box['id'] ) . '" />';
   245 	submit_button( __( 'Submit' ) );
   245 	submit_button( __( 'Save Changes' ) );
   246 	echo '</form>';
   246 	echo '</form>';
   247 }
   247 }
   248 
   248 
   249 /**
   249 /**
   250  * Displays the dashboard.
   250  * Displays the dashboard.
   683 	$GLOBALS['comment'] = clone $comment;
   683 	$GLOBALS['comment'] = clone $comment;
   684 
   684 
   685 	if ( $comment->comment_post_ID > 0 ) {
   685 	if ( $comment->comment_post_ID > 0 ) {
   686 		$comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
   686 		$comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
   687 		$comment_post_url   = get_the_permalink( $comment->comment_post_ID );
   687 		$comment_post_url   = get_the_permalink( $comment->comment_post_ID );
   688 		$comment_post_link  = "<a href='$comment_post_url'>$comment_post_title</a>";
   688 		$comment_post_link  = '<a href="' . esc_url( $comment_post_url ) . '">' . $comment_post_title . '</a>';
   689 	} else {
   689 	} else {
   690 		$comment_post_link = '';
   690 		$comment_post_link = '';
   691 	}
   691 	}
   692 
   692 
   693 	$actions_string = '';
   693 	$actions_string = '';
  1348 	<div id="community-events" class="community-events" aria-hidden="true">
  1348 	<div id="community-events" class="community-events" aria-hidden="true">
  1349 		<div class="activity-block">
  1349 		<div class="activity-block">
  1350 			<p>
  1350 			<p>
  1351 				<span id="community-events-location-message"></span>
  1351 				<span id="community-events-location-message"></span>
  1352 
  1352 
  1353 				<button class="button-link community-events-toggle-location" aria-label="<?php esc_attr_e( 'Edit city' ); ?>" aria-expanded="false">
  1353 				<button class="button-link community-events-toggle-location" aria-expanded="false">
  1354 					<span class="dashicons dashicons-edit"></span>
  1354 					<span class="dashicons dashicons-location" aria-hidden="true"></span>
       
  1355 					<span class="community-events-location-edit"><?php _e( 'Select location' ); ?></span>
  1355 				</button>
  1356 				</button>
  1356 			</p>
  1357 			</p>
  1357 
  1358 
  1358 			<form class="community-events-form" aria-hidden="true" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post">
  1359 			<form class="community-events-form" aria-hidden="true" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post">
  1359 				<label for="community-events-location">
  1360 				<label for="community-events-location">
  1411 			/* translators: %s is the name of the city we couldn't locate.
  1412 			/* translators: %s is the name of the city we couldn't locate.
  1412 			 * Replace the examples with cities in your locale, but test
  1413 			 * Replace the examples with cities in your locale, but test
  1413 			 * that they match the expected location before including them.
  1414 			 * that they match the expected location before including them.
  1414 			 * Use endonyms (native locale names) whenever possible.
  1415 			 * Use endonyms (native locale names) whenever possible.
  1415 			 */
  1416 			 */
  1416 			__( 'We couldn&#8217;t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
  1417 			__( '%s could not be located. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
  1417 			'<em>{{data.unknownCity}}</em>'
  1418 			'<em>{{data.unknownCity}}</em>'
  1418 		);
  1419 		);
  1419 		?>
  1420 		?>
  1420 	</script>
  1421 	</script>
  1421 
  1422 
  1459 		<li class="event-none">
  1460 		<li class="event-none">
  1460 			<# if ( data.location.description ) { #>
  1461 			<# if ( data.location.description ) { #>
  1461 				<?php
  1462 				<?php
  1462 				printf(
  1463 				printf(
  1463 					/* translators: 1: The city the user searched for, 2: Meetup organization documentation URL. */
  1464 					/* translators: 1: The city the user searched for, 2: Meetup organization documentation URL. */
  1464 					__( 'There aren&#8217;t any events scheduled near %1$s at the moment. Would you like to <a href="%2$s">organize a WordPress event</a>?' ),
  1465 					__( 'There are no events scheduled near %1$s at the moment. Would you like to <a href="%2$s">organize a WordPress event</a>?' ),
  1465 					'{{ data.location.description }}',
  1466 					'{{ data.location.description }}',
  1466 					__( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' )
  1467 					__( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' )
  1467 				);
  1468 				);
  1468 				?>
  1469 				?>
  1469 
  1470 
  1470 			<# } else { #>
  1471 			<# } else { #>
  1471 				<?php
  1472 				<?php
  1472 				printf(
  1473 				printf(
  1473 					/* translators: %s: Meetup organization documentation URL. */
  1474 					/* translators: %s: Meetup organization documentation URL. */
  1474 					__( 'There aren&#8217;t any events scheduled near you at the moment. Would you like to <a href="%s">organize a WordPress event</a>?' ),
  1475 					__( 'There are no events scheduled near you at the moment. Would you like to <a href="%s">organize a WordPress event</a>?' ),
  1475 					__( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' )
  1476 					__( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' )
  1476 				);
  1477 				);
  1477 				?>
  1478 				?>
  1478 			<# } #>
  1479 			<# } #>
  1479 		</li>
  1480 		</li>
  1687 
  1688 
  1688 		$browser_nag_class = '';
  1689 		$browser_nag_class = '';
  1689 		if ( ! empty( $response['img_src'] ) ) {
  1690 		if ( ! empty( $response['img_src'] ) ) {
  1690 			$img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) ) ? $response['img_src_ssl'] : $response['img_src'];
  1691 			$img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) ) ? $response['img_src_ssl'] : $response['img_src'];
  1691 
  1692 
  1692 			$notice           .= '<div class="alignright browser-icon"><img src="' . esc_attr( $img_src ) . '" alt="" /></div>';
  1693 			$notice           .= '<div class="alignright browser-icon"><img src="' . esc_url( $img_src ) . '" alt="" /></div>';
  1693 			$browser_nag_class = ' has-browser-icon';
  1694 			$browser_nag_class = ' has-browser-icon';
  1694 		}
  1695 		}
  1695 		$notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";
  1696 		$notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";
  1696 
  1697 
  1697 		$browsehappy = 'https://browsehappy.com/';
  1698 		$browsehappy = 'https://browsehappy.com/';
  1724 	/**
  1725 	/**
  1725 	 * Filters the notice output for the 'Browse Happy' nag meta box.
  1726 	 * Filters the notice output for the 'Browse Happy' nag meta box.
  1726 	 *
  1727 	 *
  1727 	 * @since 3.2.0
  1728 	 * @since 3.2.0
  1728 	 *
  1729 	 *
  1729 	 * @param string $notice   The notice content.
  1730 	 * @param string      $notice   The notice content.
  1730 	 * @param array  $response An array containing web browser information. See `wp_check_browser_version()`.
  1731 	 * @param array|false $response An array containing web browser information, or
       
  1732 	 *                              false on failure. See `wp_check_browser_version()`.
  1731 	 */
  1733 	 */
  1732 	echo apply_filters( 'browse-happy-notice', $notice, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
  1734 	echo apply_filters( 'browse-happy-notice', $notice, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
  1733 }
  1735 }
  1734 
  1736 
  1735 /**
  1737 /**
  1983 
  1985 
  1984 /**
  1986 /**
  1985  * Displays a welcome panel to introduce users to WordPress.
  1987  * Displays a welcome panel to introduce users to WordPress.
  1986  *
  1988  *
  1987  * @since 3.3.0
  1989  * @since 3.3.0
       
  1990  * @since 5.9.0 Send users to the Site Editor if the active theme is block-based.
  1988  */
  1991  */
  1989 function wp_welcome_panel() {
  1992 function wp_welcome_panel() {
       
  1993 	list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );
       
  1994 	$can_customize           = current_user_can( 'customize' );
       
  1995 	$is_block_theme          = wp_is_block_theme();
  1990 	?>
  1996 	?>
  1991 	<div class="welcome-panel-content">
  1997 	<div class="welcome-panel-content">
  1992 	<h2><?php _e( 'Welcome to WordPress!' ); ?></h2>
  1998 	<div class="welcome-panel-header">
  1993 	<p class="about-description"><?php _e( 'We&#8217;ve assembled some links to get you started:' ); ?></p>
  1999 		<div class="welcome-panel-header-image">
       
  2000 			<?php echo file_get_contents( dirname( __DIR__ ) . '/images/about-header-about.svg' ); ?>
       
  2001 		</div>
       
  2002 		<h2><?php _e( 'Welcome to WordPress!' ); ?></h2>
       
  2003 		<p>
       
  2004 			<a href="<?php echo esc_url( admin_url( 'about.php' ) ); ?>">
       
  2005 			<?php
       
  2006 				/* translators: %s: Current WordPress version. */
       
  2007 				printf( __( 'Learn more about the %s version.' ), $display_version );
       
  2008 			?>
       
  2009 			</a>
       
  2010 		</p>
       
  2011 	</div>
  1994 	<div class="welcome-panel-column-container">
  2012 	<div class="welcome-panel-column-container">
  1995 	<div class="welcome-panel-column">
  2013 		<div class="welcome-panel-column">
  1996 		<?php if ( current_user_can( 'customize' ) ) : ?>
  2014 			<div class="welcome-panel-icon-pages"></div>
  1997 			<h3><?php _e( 'Get Started' ); ?></h3>
  2015 			<div class="welcome-panel-column-content">
  1998 			<a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Customize Your Site' ); ?></a>
  2016 				<h3><?php _e( 'Author rich content with blocks and patterns' ); ?></h3>
  1999 		<?php endif; ?>
  2017 				<p><?php _e( 'Block patterns are pre-configured block layouts. Use them to get inspired or create new pages in a flash.' ); ?></p>
  2000 		<a class="button button-primary button-hero hide-if-customize" href="<?php echo esc_url( admin_url( 'themes.php' ) ); ?>"><?php _e( 'Customize Your Site' ); ?></a>
  2018 				<a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=page' ) ); ?>"><?php _e( 'Add a new page' ); ?></a>
  2001 		<?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?>
  2019 			</div>
  2002 			<?php $themes_link = current_user_can( 'customize' ) ? add_query_arg( 'autofocus[panel]', 'themes', admin_url( 'customize.php' ) ) : admin_url( 'themes.php' ); ?>
  2020 		</div>
  2003 			<p class="hide-if-no-customize">
  2021 		<div class="welcome-panel-column">
  2004 				<?php
  2022 			<div class="welcome-panel-icon-layout"></div>
  2005 					/* translators: %s: URL to Themes panel in Customizer or Themes screen. */
  2023 			<div class="welcome-panel-column-content">
  2006 					printf( __( 'or, <a href="%s">change your theme completely</a>' ), $themes_link );
  2024 			<?php if ( $is_block_theme ) : ?>
  2007 				?>
  2025 				<h3><?php _e( 'Customize your entire site with block themes' ); ?></h3>
  2008 			</p>
  2026 				<p><?php _e( 'Design everything on your site &#8212; from the header down to the footer, all using blocks and patterns.' ); ?></p>
  2009 		<?php endif; ?>
  2027 				<a href="<?php echo esc_url( admin_url( 'site-editor.php' ) ); ?>"><?php _e( 'Open site editor' ); ?></a>
  2010 	</div>
  2028 			<?php else : ?>
  2011 	<div class="welcome-panel-column">
  2029 				<h3><?php _e( 'Start Customizing' ); ?></h3>
  2012 		<h3><?php _e( 'Next Steps' ); ?></h3>
  2030 				<p><?php _e( 'Configure your site&#8217;s logo, header, menus, and more in the Customizer.' ); ?></p>
  2013 		<ul>
  2031 				<?php if ( $can_customize ) : ?>
  2014 		<?php if ( 'page' === get_option( 'show_on_front' ) && ! get_option( 'page_for_posts' ) ) : ?>
  2032 					<a class="load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Open the Customizer' ); ?></a>
  2015 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
  2033 				<?php endif; ?>
  2016 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
  2034 			<?php endif; ?>
  2017 		<?php elseif ( 'page' === get_option( 'show_on_front' ) ) : ?>
  2035 			</div>
  2018 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
  2036 		</div>
  2019 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
  2037 		<div class="welcome-panel-column">
  2020 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
  2038 			<div class="welcome-panel-icon-styles"></div>
  2021 		<?php else : ?>
  2039 			<div class="welcome-panel-column-content">
  2022 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
  2040 			<?php if ( $is_block_theme ) : ?>
  2023 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add an About page' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
  2041 				<h3><?php _e( 'Switch up your site&#8217;s look & feel with Styles' ); ?></h3>
  2024 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-setup-home">' . __( 'Set up your homepage' ) . '</a>', current_user_can( 'customize' ) ? add_query_arg( 'autofocus[section]', 'static_front_page', admin_url( 'customize.php' ) ) : admin_url( 'options-reading.php' ) ); ?></li>
  2042 				<p><?php _e( 'Tweak your site, or give it a whole new look! Get creative &#8212; how about a new color palette or font?' ); ?></p>
  2025 		<?php endif; ?>
  2043 				<a href="<?php echo esc_url( admin_url( 'site-editor.php?styles=open' ) ); ?>"><?php _e( 'Edit styles' ); ?></a>
  2026 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-view-site">' . __( 'View your site' ) . '</a>', home_url( '/' ) ); ?></li>
  2044 			<?php else : ?>
  2027 		</ul>
  2045 				<h3><?php _e( 'Discover a new way to build your site.' ); ?></h3>
  2028 	</div>
  2046 				<p><?php _e( 'There is a new kind of WordPress theme, called a block theme, that lets you build the site you&#8217;ve always wanted &#8212; with blocks and styles.' ); ?></p>
  2029 	<div class="welcome-panel-column welcome-panel-last">
  2047 				<a href="<?php echo esc_url( __( 'https://wordpress.org/support/article/block-themes/' ) ); ?>"><?php _e( 'Learn about block themes' ); ?></a>
  2030 		<h3><?php _e( 'More Actions' ); ?></h3>
  2048 			<?php endif; ?>
  2031 		<ul>
  2049 			</div>
  2032 		<?php if ( current_theme_supports( 'widgets' ) ) : ?>
  2050 		</div>
  2033 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-widgets">' . __( 'Manage widgets' ) . '</a>', admin_url( 'widgets.php' ) ); ?></li>
       
  2034 		<?php endif; ?>
       
  2035 		<?php if ( current_theme_supports( 'menus' ) ) : ?>
       
  2036 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-menus">' . __( 'Manage menus' ) . '</a>', admin_url( 'nav-menus.php' ) ); ?></li>
       
  2037 		<?php endif; ?>
       
  2038 		<?php if ( current_user_can( 'manage_options' ) ) : ?>
       
  2039 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-comments">' . __( 'Turn comments on or off' ) . '</a>', admin_url( 'options-discussion.php' ) ); ?></li>
       
  2040 		<?php endif; ?>
       
  2041 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-learn-more">' . __( 'Learn more about getting started' ) . '</a>', __( 'https://wordpress.org/support/article/first-steps-with-wordpress/' ) ); ?></li>
       
  2042 		</ul>
       
  2043 	</div>
       
  2044 	</div>
  2051 	</div>
  2045 	</div>
  2052 	</div>
  2046 	<?php
  2053 	<?php
  2047 }
  2054 }