wp/wp-admin/includes/class-wp-ms-themes-list-table.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    61 		$page = $this->get_pagenum();
    61 		$page = $this->get_pagenum();
    62 
    62 
    63 		$this->is_site_themes = ( 'site-themes-network' === $this->screen->id ) ? true : false;
    63 		$this->is_site_themes = ( 'site-themes-network' === $this->screen->id ) ? true : false;
    64 
    64 
    65 		if ( $this->is_site_themes ) {
    65 		if ( $this->is_site_themes ) {
    66 			$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
    66 			$this->site_id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0;
    67 		}
    67 		}
    68 
    68 
    69 		$this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'theme' ) &&
    69 		$this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'theme' ) &&
    70 			! $this->is_site_themes && current_user_can( 'update_themes' );
    70 			! $this->is_site_themes && current_user_can( 'update_themes' );
    71 	}
    71 	}
   177 				'package'      => '',
   177 				'package'      => '',
   178 				'requires'     => '',
   178 				'requires'     => '',
   179 				'requires_php' => '',
   179 				'requires_php' => '',
   180 			);
   180 			);
   181 
   181 
   182 			$filter_payload = array_merge( $filter_payload, array_intersect_key( $theme_data, $filter_payload ) );
   182 			$filter_payload = (object) array_merge( $filter_payload, array_intersect_key( $theme_data, $filter_payload ) );
   183 
   183 
   184 			$type = 'theme';
   184 			$auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, $filter_payload );
   185 			/** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
       
   186 			$auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $filter_payload );
       
   187 
   185 
   188 			if ( ! is_null( $auto_update_forced ) ) {
   186 			if ( ! is_null( $auto_update_forced ) ) {
   189 				$theme->auto_update_forced = $auto_update_forced;
   187 				$theme->auto_update_forced = $auto_update_forced;
   190 			}
   188 			}
   191 
   189 
   206 		if ( $s ) {
   204 		if ( $s ) {
   207 			$status           = 'search';
   205 			$status           = 'search';
   208 			$themes['search'] = array_filter( array_merge( $themes['all'], $themes['broken'] ), array( $this, '_search_callback' ) );
   206 			$themes['search'] = array_filter( array_merge( $themes['all'], $themes['broken'] ), array( $this, '_search_callback' ) );
   209 		}
   207 		}
   210 
   208 
   211 		$totals = array();
   209 		$totals    = array();
       
   210 		$js_themes = array();
   212 		foreach ( $themes as $type => $list ) {
   211 		foreach ( $themes as $type => $list ) {
   213 			$totals[ $type ] = count( $list );
   212 			$totals[ $type ]    = count( $list );
       
   213 			$js_themes[ $type ] = array_keys( $list );
   214 		}
   214 		}
   215 
   215 
   216 		if ( empty( $themes[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) {
   216 		if ( empty( $themes[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) {
   217 			$status = 'all';
   217 			$status = 'all';
   218 		}
   218 		}
   225 
   225 
   226 		wp_localize_script(
   226 		wp_localize_script(
   227 			'updates',
   227 			'updates',
   228 			'_wpUpdatesItemCounts',
   228 			'_wpUpdatesItemCounts',
   229 			array(
   229 			array(
   230 				'themes' => $totals,
   230 				'themes' => $js_themes,
   231 				'totals' => wp_get_update_data(),
   231 				'totals' => wp_get_update_data(),
   232 			)
   232 			)
   233 		);
   233 		);
   234 
   234 
   235 		if ( $orderby ) {
   235 		if ( $orderby ) {
   299 		global $orderby, $order;
   299 		global $orderby, $order;
   300 
   300 
   301 		$a = $theme_a[ $orderby ];
   301 		$a = $theme_a[ $orderby ];
   302 		$b = $theme_b[ $orderby ];
   302 		$b = $theme_b[ $orderby ];
   303 
   303 
   304 		if ( $a == $b ) {
   304 		if ( $a === $b ) {
   305 			return 0;
   305 			return 0;
   306 		}
   306 		}
   307 
   307 
   308 		if ( 'DESC' === $order ) {
   308 		if ( 'DESC' === $order ) {
   309 			return ( $a < $b ) ? 1 : -1;
   309 			return ( $a < $b ) ? 1 : -1;
   726 				esc_attr( $aria_label ),
   726 				esc_attr( $aria_label ),
   727 				__( 'Visit Theme Site' )
   727 				__( 'Visit Theme Site' )
   728 			);
   728 			);
   729 		}
   729 		}
   730 
   730 
       
   731 		if ( $theme->parent() ) {
       
   732 			$theme_meta[] = sprintf(
       
   733 				/* translators: %s: Theme name. */
       
   734 				__( 'Child theme of %s' ),
       
   735 				'<strong>' . $theme->parent()->display( 'Name' ) . '</strong>'
       
   736 			);
       
   737 		}
       
   738 
   731 		/**
   739 		/**
   732 		 * Filters the array of row meta for each theme in the Multisite themes
   740 		 * Filters the array of row meta for each theme in the Multisite themes
   733 		 * list table.
   741 		 * list table.
   734 		 *
   742 		 *
   735 		 * @since 3.1.0
   743 		 * @since 3.1.0