wp/wp-admin/my-sites.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
    37 
    37 
    38 get_current_screen()->add_help_tab( array(
    38 get_current_screen()->add_help_tab( array(
    39 	'id'      => 'overview',
    39 	'id'      => 'overview',
    40 	'title'   => __('Overview'),
    40 	'title'   => __('Overview'),
    41 	'content' =>
    41 	'content' =>
    42 		'<p>' . __('This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. He or she can use the links under each site to visit either the frontend or the dashboard for that site.') . '</p>' .
    42 		'<p>' . __('This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. They can use the links under each site to visit either the frontend or the dashboard for that site.') . '</p>' .
    43 		'<p>' . __('Up until WordPress version 3.0, what is now called a Multisite Network had to be installed separately as WordPress MU (multi-user).') . '</p>'
    43 		'<p>' . __('Up until WordPress version 3.0, what is now called a Multisite Network had to be installed separately as WordPress MU (multi-user).') . '</p>'
    44 ) );
    44 ) );
    45 
    45 
    46 get_current_screen()->set_help_sidebar(
    46 get_current_screen()->set_help_sidebar(
    47 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    47 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    48 	'<p>' . __('<a href="http://codex.wordpress.org/Dashboard_My_Sites_Screen" target="_blank">Documentation on My Sites</a>') . '</p>' .
    48 	'<p>' . __('<a href="https://codex.wordpress.org/Dashboard_My_Sites_Screen" target="_blank">Documentation on My Sites</a>') . '</p>' .
    49 	'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    49 	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    50 );
    50 );
    51 
    51 
    52 require_once( ABSPATH . 'wp-admin/admin-header.php' );
    52 require_once( ABSPATH . 'wp-admin/admin-header.php' );
    53 
    53 
    54 if ( $updated ) { ?>
    54 if ( $updated ) { ?>
    55 	<div id="message" class="updated"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div>
    55 	<div id="message" class="updated notice is-dismissible"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div>
    56 <?php } ?>
    56 <?php } ?>
    57 
    57 
    58 <div class="wrap">
    58 <div class="wrap">
    59 <?php screen_icon(); ?>
       
    60 <h2><?php echo esc_html( $title ); ?></h2>
    59 <h2><?php echo esc_html( $title ); ?></h2>
    61 <?php
    60 <?php
    62 if ( empty( $blogs ) ) :
    61 if ( empty( $blogs ) ) :
    63 	echo '<p>';
    62 	echo '<p>';
    64 	_e( 'You must be a member of at least one site to use this page.' );
    63 	_e( 'You must be a member of at least one site to use this page.' );
    65 	echo '</p>';
    64 	echo '</p>';
    66 else :
    65 else :
    67 ?>
    66 ?>
    68 <form id="myblogs" action="" method="post">
    67 <form id="myblogs" method="post">
    69 	<?php
    68 	<?php
    70 	choose_primary_blog();
    69 	choose_primary_blog();
       
    70 	/**
       
    71 	 * Fires before the sites table on the My Sites screen.
       
    72 	 *
       
    73 	 * @since 3.0.0
       
    74 	 */
    71 	do_action( 'myblogs_allblogs_options' );
    75 	do_action( 'myblogs_allblogs_options' );
    72 	?>
    76 	?>
    73 	<br clear="all" />
    77 	<br clear="all" />
    74 	<table class="widefat fixed">
    78 	<table class="widefat fixed striped">
    75 	<?php
    79 	<?php
       
    80 	/**
       
    81 	 * Enable the Global Settings section on the My Sites screen.
       
    82 	 *
       
    83 	 * By default, the Global Settings section is hidden. Passing a non-empty
       
    84 	 * string to this filter will enable the section, and allow new settings
       
    85 	 * to be added, either globally or for specific sites.
       
    86 	 *
       
    87 	 * @since MU
       
    88 	 *
       
    89 	 * @param string $settings_html The settings HTML markup. Default empty.
       
    90 	 * @param object $context       Context of the setting (global or site-specific). Default 'global'.
       
    91 	 */
    76 	$settings_html = apply_filters( 'myblogs_options', '', 'global' );
    92 	$settings_html = apply_filters( 'myblogs_options', '', 'global' );
    77 	if ( $settings_html != '' ) {
    93 	if ( $settings_html != '' ) {
    78 		echo '<tr><td valign="top"><h3>' . __( 'Global Settings' ) . '</h3></td><td>';
    94 		echo '<tr><td><h3>' . __( 'Global Settings' ) . '</h3></td><td>';
    79 		echo $settings_html;
    95 		echo $settings_html;
    80 		echo '</td></tr>';
    96 		echo '</td></tr>';
    81 	}
    97 	}
    82 	reset( $blogs );
    98 	reset( $blogs );
    83 	$num = count( $blogs );
    99 	$num = count( $blogs );
    91 	for ( $i = 1; $i <= $num_rows; $i++ ) {
   107 	for ( $i = 1; $i <= $num_rows; $i++ ) {
    92 		$rows[] = array_slice( $blogs, $split, $cols );
   108 		$rows[] = array_slice( $blogs, $split, $cols );
    93 		$split = $split + $cols;
   109 		$split = $split + $cols;
    94 	}
   110 	}
    95 
   111 
    96 	$c = '';
       
    97 	foreach ( $rows as $row ) {
   112 	foreach ( $rows as $row ) {
    98 		$c = $c == 'alternate' ? '' : 'alternate';
   113 		echo "<tr>";
    99 		echo "<tr class='$c'>";
       
   100 		$i = 0;
   114 		$i = 0;
   101 		foreach ( $row as $user_blog ) {
   115 		foreach ( $row as $user_blog ) {
   102 			$s = $i == 3 ? '' : 'border-right: 1px solid #ccc;';
   116 			$s = $i == 3 ? '' : 'border-right: 1px solid #ccc;';
   103 			echo "<td valign='top' style='$s'>";
   117 			echo "<td style='$s'>";
   104 			echo "<h3>{$user_blog->blogname}</h3>";
   118 			echo "<h3>{$user_blog->blogname}</h3>";
       
   119 			/**
       
   120 			 * Filter the row links displayed for each site on the My Sites screen.
       
   121 			 *
       
   122 			 * @since MU
       
   123 			 *
       
   124 			 * @param string $string    The HTML site link markup.
       
   125 			 * @param object $user_blog An object containing the site data.
       
   126 			 */
   105 			echo "<p>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
   127 			echo "<p>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
       
   128 			/** This filter is documented in wp-admin/my-sites.php */
   106 			echo apply_filters( 'myblogs_options', '', $user_blog );
   129 			echo apply_filters( 'myblogs_options', '', $user_blog );
   107 			echo "</td>";
   130 			echo "</td>";
   108 			$i++;
   131 			$i++;
   109 		}
   132 		}
   110 		echo "</tr>";
   133 		echo "</tr>";