wp/wp-admin/includes/class-wp-themes-list-table.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
--- a/wp/wp-admin/includes/class-wp-themes-list-table.php	Tue Jun 09 11:14:17 2015 +0000
+++ b/wp/wp-admin/includes/class-wp-themes-list-table.php	Mon Oct 14 17:39:30 2019 +0200
@@ -1,11 +1,19 @@
 <?php
 /**
- * Themes List Table class.
+ * List Table API: WP_Themes_List_Table class
  *
  * @package WordPress
- * @subpackage List_Table
+ * @subpackage Administration
+ * @since 3.1.0
+ */
+
+/**
+ * Core class used to implement displaying installed themes in a list table.
+ *
  * @since 3.1.0
  * @access private
+ *
+ * @see WP_List_Table
  */
 class WP_Themes_List_Table extends WP_List_Table {
 
@@ -16,7 +24,6 @@
 	 * Constructor.
 	 *
 	 * @since 3.1.0
-	 * @access public
 	 *
 	 * @see WP_List_Table::__construct() for more information on default arguments.
 	 *
@@ -29,11 +36,17 @@
 		) );
 	}
 
+	/**
+	 *
+	 * @return bool
+	 */
 	public function ajax_user_can() {
-		// Do not check edit_theme_options here. AJAX calls for available themes require switch_themes.
+		// Do not check edit_theme_options here. Ajax calls for available themes require switch_themes.
 		return current_user_can( 'switch_themes' );
 	}
 
+	/**
+	 */
 	public function prepare_items() {
 		$themes = wp_get_themes( array( 'allowed' => true ) );
 
@@ -67,26 +80,29 @@
 		) );
 	}
 
+	/**
+	 */
 	public function no_items() {
 		if ( $this->search_terms || $this->features ) {
 			_e( 'No items found.' );
 			return;
 		}
 
+		$blog_id = get_current_blog_id();
 		if ( is_multisite() ) {
 			if ( current_user_can( 'install_themes' ) && current_user_can( 'manage_network_themes' ) ) {
-				printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> or <a href="%2$s">install</a> more themes.' ), network_admin_url( 'site-themes.php?id=' . $GLOBALS['blog_id'] ), network_admin_url( 'theme-install.php' ) );
+				printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> or <a href="%2$s">install</a> more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ), network_admin_url( 'theme-install.php' ) );
 
 				return;
 			} elseif ( current_user_can( 'manage_network_themes' ) ) {
-				printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> more themes.' ), network_admin_url( 'site-themes.php?id=' . $GLOBALS['blog_id'] ) );
+				printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ) );
 
 				return;
 			}
 			// Else, fallthrough. install_themes doesn't help if you can't enable it.
 		} else {
 			if ( current_user_can( 'install_themes' ) ) {
-				printf( __( 'You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress.org Theme Directory at any time: just click on the <a href="%s">Install Themes</a> tab above.' ), admin_url( 'theme-install.php' ) );
+				printf( __( 'You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress Theme Directory at any time: just click on the <a href="%s">Install Themes</a> tab above.' ), admin_url( 'theme-install.php' ) );
 
 				return;
 			}
@@ -97,7 +113,6 @@
 
 	/**
 	 * @param string $which
-	 * @return null
 	 */
 	public function tablenav( $which = 'top' ) {
 		if ( $this->get_pagination_arg( 'total_pages' ) <= 1 )
@@ -111,6 +126,8 @@
 		<?php
 	}
 
+	/**
+	 */
 	public function display() {
 		wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
 ?>
@@ -124,10 +141,16 @@
 <?php
 	}
 
+	/**
+	 *
+	 * @return array
+	 */
 	public function get_columns() {
 		return array();
 	}
 
+	/**
+	 */
 	public function display_rows_or_placeholder() {
 		if ( $this->has_items() ) {
 			$this->display_rows();
@@ -138,6 +161,8 @@
 		}
 	}
 
+	/**
+	 */
 	public function display_rows() {
 		$themes = $this->items;
 
@@ -152,17 +177,10 @@
 
 			$activate_link = wp_nonce_url( "themes.php?action=activate&amp;template=" . urlencode( $template ) . "&amp;stylesheet=" . urlencode( $stylesheet ), 'switch-theme_' . $stylesheet );
 
-			$preview_link = esc_url( add_query_arg(
-				array( 'preview' => 1, 'template' => urlencode( $template ), 'stylesheet' => urlencode( $stylesheet ), 'preview_iframe' => true, 'TB_iframe' => 'true' ),
-				home_url( '/' ) ) );
-
 			$actions = array();
 			$actions['activate'] = '<a href="' . $activate_link . '" class="activatelink" title="'
 				. esc_attr( sprintf( __( 'Activate &#8220;%s&#8221;' ), $title ) ) . '">' . __( 'Activate' ) . '</a>';
 
-			$actions['preview'] = '<a href="' . $preview_link . '" class="hide-if-customize" title="'
-				. esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '">' . __( 'Preview' ) . '</a>';
-
 			if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
 				$actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="load-customize hide-if-no-customize">'
 					. __( 'Live Preview' ) . '</a>';
@@ -174,20 +192,20 @@
 					. "' );" . '">' . __( 'Delete' ) . '</a>';
 
 			/** This filter is documented in wp-admin/includes/class-wp-ms-themes-list-table.php */
-			$actions       = apply_filters( 'theme_action_links', $actions, $theme );
+			$actions       = apply_filters( 'theme_action_links', $actions, $theme, 'all' );
 
 			/** This filter is documented in wp-admin/includes/class-wp-ms-themes-list-table.php */
-			$actions       = apply_filters( "theme_action_links_$stylesheet", $actions, $theme );
+			$actions       = apply_filters( "theme_action_links_$stylesheet", $actions, $theme, 'all' );
 			$delete_action = isset( $actions['delete'] ) ? '<div class="delete-theme">' . $actions['delete'] . '</div>' : '';
 			unset( $actions['delete'] );
 
 			?>
 
-			<a href="<?php echo $preview_link; ?>" class="screenshot hide-if-customize">
+			<span class="screenshot hide-if-customize">
 				<?php if ( $screenshot = $theme->get_screenshot() ) : ?>
 					<img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
 				<?php endif; ?>
-			</a>
+			</span>
 			<a href="<?php echo wp_customize_url( $stylesheet ); ?>" class="screenshot load-customize hide-if-no-customize">
 				<?php if ( $screenshot = $theme->get_screenshot() ) : ?>
 					<img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
@@ -262,7 +280,6 @@
 	 * Send required variables to JavaScript land
 	 *
 	 * @since 3.4.0
-	 * @access public
 	 *
 	 * @param array $extra_args
 	 */