<?php
/**
 * The template to display Admin notices
 *
 * @package PANTRY
 * @since PANTRY 1.0.64
 */

$pantry_skins_url  = get_admin_url( null, 'admin.php?page=trx_addons_theme_panel#trx_addons_theme_panel_section_skins' );
$pantry_skins_args = get_query_var( 'pantry_skins_notice_args' );
?>
<div class="pantry_admin_notice pantry_skins_notice notice notice-info is-dismissible" data-notice="skins">
	<?php
	// Theme image
	$pantry_theme_img = pantry_get_file_url( 'screenshot.jpg' );
	if ( '' != $pantry_theme_img ) {
		?>
		<div class="pantry_notice_image"><img src="<?php echo esc_url( $pantry_theme_img ); ?>" alt="<?php esc_attr_e( 'Theme screenshot', 'pantry' ); ?>"></div>
		<?php
	}

	// Title
	?>
	<h3 class="pantry_notice_title">
		<?php esc_html_e( 'New skins are available', 'pantry' ); ?>
	</h3>
	<?php

	// Description
	$pantry_total      = $pantry_skins_args['update'];	// Store value to the separate variable to avoid warnings from ThemeCheck plugin!
	$pantry_skins_msg  = $pantry_total > 0
							// Translators: Add new skins number
							? '<strong>' . sprintf( _n( '%d new version', '%d new versions', $pantry_total, 'pantry' ), $pantry_total ) . '</strong>'
							: '';
	$pantry_total      = $pantry_skins_args['free'];
	$pantry_skins_msg .= $pantry_total > 0
							? ( ! empty( $pantry_skins_msg ) ? ' ' . esc_html__( 'and', 'pantry' ) . ' ' : '' )
								// Translators: Add new skins number
								. '<strong>' . sprintf( _n( '%d free skin', '%d free skins', $pantry_total, 'pantry' ), $pantry_total ) . '</strong>'
							: '';
	$pantry_total      = $pantry_skins_args['pay'];
	$pantry_skins_msg .= $pantry_skins_args['pay'] > 0
							? ( ! empty( $pantry_skins_msg ) ? ' ' . esc_html__( 'and', 'pantry' ) . ' ' : '' )
								// Translators: Add new skins number
								. '<strong>' . sprintf( _n( '%d paid skin', '%d paid skins', $pantry_total, 'pantry' ), $pantry_total ) . '</strong>'
							: '';
	?>
	<div class="pantry_notice_text">
		<p>
			<?php
			// Translators: Add new skins info
			echo wp_kses_data( sprintf( __( "We are pleased to announce that %s are available for your theme", 'pantry' ), $pantry_skins_msg ) );
			?>
		</p>
	</div>
	<?php

	// Buttons
	?>
	<div class="pantry_notice_buttons">
		<?php
		// Link to the theme dashboard page
		?>
		<a href="<?php echo esc_url( $pantry_skins_url ); ?>" class="button button-primary"><i class="dashicons dashicons-update"></i> 
			<?php
			// Translators: Add theme name
			esc_html_e( 'Go to Skins manager', 'pantry' );
			?>
		</a>
	</div>
</div>
