acf_pro_render_license_status_table()ACF 6.2.3

Renders the license status table.

Хуков нет.

Возвращает

null. Ничего (null).

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

acf_pro_render_license_status_table( $status );
$status(массив) (обязательный)
The current license status array.

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

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

Код acf_pro_render_license_status_table() ACF 6.4.2

<?php
function acf_pro_render_license_status_table( $status ) {
	// Bail early if we don't have a status from the server.
	if ( acf_pro_get_license_key() && empty( $status['status'] ) ) {
		return;
	}

	$status['status'] = ! empty( $status['status'] ) ? $status['status'] : 'inactive';
	$status_text      = _x( 'Inactive', 'license status', 'acf' );
	$is_lifetime      = ! empty( $status['lifetime'] );

	if ( 'active' === $status['status'] ) {
		$status_text = _x( 'Active', 'license status', 'acf' );
	} elseif ( 'expired' === $status['status'] ) {
		$status_text = _x( 'Expired', 'license status', 'acf' );
	} elseif ( 'cancelled' === $status['status'] ) {
		$status_text = _x( 'Cancelled', 'license status', 'acf' );
	}

	$indicator = '<span class="acf-license-status ' . esc_attr( $status['status'] ) . '">' . esc_html( $status_text ) . '</span>';
	?>

	<table class="acf-license-status-table">
		<tr>
			<th>
				<?php
				if ( $is_lifetime || 'inactive' === $status['status'] ) {
					esc_html_e( 'License Status', 'acf' );
				} else {
					esc_html_e( 'Subscription Status', 'acf' );
				}
				?>
			</th>
			<td><?php echo acf_esc_html( $indicator ); ?></td>
		</tr>
		<?php if ( ! empty( $status['name'] ) ) : ?>
		<tr>
			<th>
				<?php
				if ( $is_lifetime ) {
					esc_html_e( 'License Type', 'acf' );
				} else {
					esc_html_e( 'Subscription Type', 'acf' );
				}
				?>
			</th>
			<td>
				<?php
				if ( $is_lifetime ) {
					esc_html_e( 'Lifetime - ', 'acf' );
				}
				echo esc_html( $status['name'] );
				?>
			</td>
		</tr>
		<?php endif; ?>
		<?php if ( ! $is_lifetime && ! empty( $status['expiry'] ) && is_numeric( $status['expiry'] ) ) : ?>
		<tr>
			<th>
				<?php
				if ( acf_pro_is_license_expired( $status ) ) {
					esc_html_e( 'Subscription Expired', 'acf' );
				} else {
					esc_html_e( 'Subscription Expires', 'acf' );
				}
				?>
			</th>
			<td>
				<?php
				$date_format = get_option( 'date_format', 'F j, Y' );
				$expiry_date = date_i18n( $date_format, $status['expiry'] );
				echo esc_html( $expiry_date );
				?>
			</td>
		</tr>
		<?php endif; ?>
	</table>
	<?php
}