WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_MS_Themes_List_Table::column_autoupdates() public WP 5.5.0

Handles the auto-updates column output.

Это метод класса: WP_MS_Themes_List_Table{}

Хуки из метода
Возвращает

Null. Ничего.

Использование

$WP_MS_Themes_List_Table = new WP_MS_Themes_List_Table();
$WP_MS_Themes_List_Table->column_autoupdates( $theme );
$theme(WP_Theme) (обязательный)
The current WP_Theme object.

Заметки

  • Global. Строка. $status
  • Global. Число. $page

Список изменений

С версии 5.5.0 Введена.

Код WP_MS_Themes_List_Table::column_autoupdates() WP 5.5.1

wp-admin/includes/class-wp-ms-themes-list-table.php
<?php
public function column_autoupdates( $theme ) {
	global $status, $page;

	static $auto_updates, $available_updates;

	if ( ! $auto_updates ) {
		$auto_updates = (array) get_site_option( 'auto_update_themes', array() );
	}
	if ( ! $available_updates ) {
		$available_updates = get_site_transient( 'update_themes' );
	}

	$stylesheet = $theme->get_stylesheet();

	if ( isset( $theme->auto_update_forced ) ) {
		if ( $theme->auto_update_forced ) {
			// Forced on.
			$text = __( 'Auto-updates enabled' );
		} else {
			$text = __( 'Auto-updates disabled' );
		}
		$action     = 'unavailable';
		$time_class = ' hidden';
	} elseif ( empty( $theme->update_supported ) ) {
		$text       = '';
		$action     = 'unavailable';
		$time_class = ' hidden';
	} elseif ( in_array( $stylesheet, $auto_updates, true ) ) {
		$text       = __( 'Disable auto-updates' );
		$action     = 'disable';
		$time_class = '';
	} else {
		$text       = __( 'Enable auto-updates' );
		$action     = 'enable';
		$time_class = ' hidden';
	}

	$query_args = array(
		'action'       => "{$action}-auto-update",
		'theme'        => $stylesheet,
		'paged'        => $page,
		'theme_status' => $status,
	);

	$url = add_query_arg( $query_args, 'themes.php' );

	if ( 'unavailable' === $action ) {
		$html[] = '<span class="label">' . $text . '</span>';
	} else {
		$html[] = sprintf(
			'<a href="%s" class="toggle-auto-update aria-button-if-js" data-wp-action="%s">',
			wp_nonce_url( $url, 'updates' ),
			$action
		);

		$html[] = '<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span>';
		$html[] = '<span class="label">' . $text . '</span>';
		$html[] = '</a>';

	}

	if ( isset( $available_updates->response[ $stylesheet ] ) ) {
		$html[] = sprintf(
			'<div class="auto-update-time%s">%s</div>',
			$time_class,
			wp_get_auto_update_message()
		);
	}

	$html = implode( '', $html );

	/**
	 * Filters the HTML of the auto-updates setting for each theme in the Themes list table.
	 *
	 * @since 5.5.0
	 *
	 * @param string   $html       The HTML for theme's auto-update setting, including
	 *                             toggle auto-update action link and time to next update.
	 * @param string   $stylesheet Directory name of the theme.
	 * @param WP_Theme $theme      WP_Theme object.
	 */
	echo apply_filters( 'theme_auto_update_setting_html', $html, $stylesheet, $theme );

	echo '<div class="notice notice-error notice-alt inline hidden"><p></p></div>';
}