<?php
/**
 * Kalium WordPress Theme
 *
 * What's new page.
 *
 * @var string $version
 * @var array  $changelog
 *
 * @author Laborator
 * @link   https://kaliumtheme.com
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Direct access not allowed.
}

?>
    <div class="row">
        <div class="col col-xs-12 col-auto">
            <div class="about-kalium__version-num">
				<?php echo esc_html( $version ); ?>
            </div>
        </div>
        <div class="col">
            <div class="about-kalium__heading no-top-margin">
                <h2>What&rsquo;s new in Kalium</h2>
                <p>
                    Kalium continuously expands with new features, bug fixes and other adjustments to provide a smoother
                    experience for everyone.
                    Scroll down to see what&rsquo;s new in this version. For a complete list of changes
                    <a href="#changelog">read the full changelog</a>.</p>
            </div>
        </div>
    </div>

    <div class="about-kalium__whats-new row">
        <div class="col col-4 col-md-6 col-xs-12">

            <div class="about-kalium__whats-new-item">
                <a href="#" target="_blank" rel="noreferrer noopener" class="about-kalium__whats-new-item-link disabled">
                    <img src="<?php echo kalium()->assets_url( 'admin/images/whats-new/2-featured-videos.gif' ); ?>" width="330" height="200" loading="lazy" alt="featured-videos">
                </a>

                <h4 class="about-kalium__whats-new-item-title">Portfolio Featured Video</h4>

                <p class="about-kalium__whats-new-item-description">
                    You asked, we listened! Make your portfolio more dynamic by adding videos as project thumbnails
                    instead of static images.
                </p>
            </div>

        </div>
        <div class="col col-4 col-md-6 col-xs-12">

            <div class="about-kalium__whats-new-item">
                <a href="#" target="_blank" rel="noreferrer noopener" class="about-kalium__whats-new-item-link disabled">
                    <img src="<?php echo kalium()->assets_url( 'admin/images/whats-new/5-breadcrumbs-support.jpg' ); ?>" width="330" height="200" loading="lazy" alt="breadcrumb-support">
                </a>

                <h4 class="about-kalium__whats-new-item-title">Breadcrumbs Support</h4>

                <p class="about-kalium__whats-new-item-description">
                    Increase the usability of your site by using breadcrumbs, you can use any of the breadcrumb types
                    Kalium offers.
                </p>
            </div>

        </div>
        <div class="col col-4 col-md-6 col-xs-12">

            <div class="about-kalium__whats-new-item">
                <a href="#" target="_blank" rel="noreferrer noopener" class="about-kalium__whats-new-item-link disabled">
                    <img src="<?php echo kalium()->assets_url( 'admin/images/whats-new/4-typolab-lineheight.gif' ); ?>" width="330" height="200" loading="lazy" alt="typolab-lineheight">
                </a>

                <h4 class="about-kalium__whats-new-item-title">Typography Line Height</h4>

                <p class="about-kalium__whats-new-item-description">
                    Now you can set your custom line-height for different elements on your Typography area. Pixels,
                    percentage and centimeters values are supported.
                </p>
            </div>

        </div>
        <div class="col col-4 col-md-6 col-xs-12">

            <div class="about-kalium__whats-new-item">
                <a href="#" target="_blank" rel="noreferrer noopener" class="about-kalium__whats-new-item-link disabled">
                    <img src="<?php echo kalium()->assets_url( 'admin/images/whats-new/1-fullscreen-project.gif' ); ?>" width="330" height="200" loading="lazy" alt="fullscreen-project">
                </a>

                <h4 class="about-kalium__whats-new-item-title">Videos in Fullscreen Item Type</h4>

                <p class="about-kalium__whats-new-item-description">
                    Now besides images, you can add your self-hosted or YouTube videos in Fullscreen Portfolio item type.
                </p>
            </div>

        </div>
        <div class="col col-4 col-md-6 col-xs-12">

            <div class="about-kalium__whats-new-item">
                <a href="#" target="_blank" rel="noreferrer noopener" class="about-kalium__whats-new-item-link disabled">
                    <img src="<?php echo kalium()->assets_url( 'admin/images/whats-new/8-php8.jpg' ); ?>" width="330" height="200" loading="lazy" alt="php8-compatibility">
                </a>

                <h4 class="about-kalium__whats-new-item-title">PHP 8 Compatibility</h4>

                <p class="about-kalium__whats-new-item-description">
                    A major version update and a remarkable milestone in PHP. It brings several new features that will
                    help us to extend Kalium possibilities even further.
                </p>
            </div>

        </div>
        <div class="col col-4 col-md-6 col-xs-12">

            <div class="about-kalium__whats-new-item">
                <a href="#" target="_blank" rel="noreferrer noopener" class="about-kalium__whats-new-item-link disabled">
                    <img src="<?php echo kalium()->assets_url( 'admin/images/whats-new/9-woocommerce50.jpg' ); ?>" width="330" height="200" loading="lazy" alt="woocommerce-compatibility">
                </a>

                <h4 class="about-kalium__whats-new-item-title">WooCommerce 5.0 Compatibility</h4>

                <p class="about-kalium__whats-new-item-description">
                    Better shopping experience with the new update from WooCommerce which is compatible with this
                    version of Kalium.
                </p>
            </div>

        </div>
        <div class="col col-4 col-md-6 col-xs-12">

            <div class="about-kalium__whats-new-item">
                <a href="#" target="_blank" rel="noreferrer noopener" class="about-kalium__whats-new-item-link disabled">
                    <img src="<?php echo kalium()->assets_url( 'admin/images/whats-new/6-top-menu.jpg' ); ?>" width="330" height="200" loading="lazy" alt="top-menu">
                </a>

                <h4 class="about-kalium__whats-new-item-title">New Widgets in Top Header Bar</h4>

                <p class="about-kalium__whats-new-item-description">
                    New widgets are now available in Top Header Bar: Breadcrumb, Date, My Account and Search Field.
                </p>
            </div>

        </div>
        <div class="col col-4 col-md-6 col-xs-12">

            <div class="about-kalium__whats-new-item">
                <a href="#" target="_blank" rel="noreferrer noopener" class="about-kalium__whats-new-item-link disabled">
                    <img src="<?php echo kalium()->assets_url( 'admin/images/whats-new/3-elementor.jpg' ); ?>" width="330" height="200" loading="lazy" alt="portfolio-in-elementor">
                </a>

                <h4 class="about-kalium__whats-new-item-title">Portfolio in Elementor</h4>

                <p class="about-kalium__whats-new-item-description">
                    You can add Portfolio Items element from Elementor with a number of options to customize for a
                    unique look.
                </p>
            </div>

        </div>
        <div class="col col-4 col-md-6 col-xs-12">

            <div class="about-kalium__whats-new-item">
                <a href="#" target="_blank" rel="noreferrer noopener" class="about-kalium__whats-new-item-link disabled">
                    <img src="<?php echo kalium()->assets_url( 'admin/images/whats-new/7-bug-fixes.jpg' ); ?>" width="330" height="200" loading="lazy" alt="bug-fixes">
                </a>

                <h4 class="about-kalium__whats-new-item-title">Bug Fixes</h4>

                <p class="about-kalium__whats-new-item-description">
                    Numerous bugs which have been reported by our users have been fixed by our team, we cannot count
                    them.
                </p>
            </div>

        </div>
    </div>

<?php
// Show changelog
if ( ! empty( $changelog ) ) :

	// Changelog date format
	$date_format = 'F d, Y';
	?>
    <a id="changelog"></a>

	<?php
	foreach ( $changelog as $changelog_entry ) :
		if ( ! kalium_get_array_key( $changelog_entry, 'expand' ) ) {
			continue;
		}
		?>
        <div class="about-kalium__changelog">
            <h3 class="about-kalium__changelog-title"><?php echo sprintf( 'Changelog &ndash; Version %s (%s)', esc_html( $changelog_entry['version'] ), esc_html( date_i18n( $date_format, strtotime( $changelog_entry['date'] ) ) ) ); ?></h3>

			<?php
			// Change type
			foreach ( $changelog_entry['changes'] as $type => $changes ) {

				if ( empty( $changes ) ) {
					continue;
				}

				?>
                <div class="about-kalium__changelog-type">
                    <div class="about-kalium__changelog-type-title about-kalium__changelog-type-title-<?php echo sanitize_title( $type ); ?>"><?php echo esc_html( $type ); ?></div>
                    <ul>
						<?php foreach ( $changes as $title ) : ?>
                            <li><?php echo links_add_target( make_clickable( esc_html( $title ) ) ); ?></li>
						<?php endforeach; ?>
                    </ul>
                </div>
				<?php
			}
			?>
        </div>
	<?php endforeach; ?>

	<?php if ( ! empty( $changelog ) ) : ?>
    <div class="about-kalium__changelog-previous-title row align-items-center">
        <div class="col">
            <h3 class="no-top-margin">Previous versions</h3>
        </div>
        <div class="col text-align-right">
            <a href="https://documentation.laborator.co/kb/kalium/kalium-changelog/" target="_blank" rel="noreferrer noopener">View
                all changelogs</a>
        </div>
    </div>

    <ul class="about-kalium__changelog-previous">
		<?php
        $i = 0;
		foreach ( $changelog as $changelog_entry ) :
			if ( kalium_get_array_key( $changelog_entry, 'expand' ) || $i >= 6 ) {
				continue;
			}
			?>
            <li class="about-kalium__changelog-previous-entry">
                <div class="about-kalium__changelog-previous-entry-date"><?php echo esc_html( date_i18n( $date_format, strtotime( $changelog_entry['date'] ) ) ); ?></div>
                <div class="about-kalium__changelog-previous-entry-version"><?php echo esc_html( $changelog_entry['version'] ); ?></div>
                <div class="about-kalium__changelog-previous-entry-link">
                    <a href="https://documentation.laborator.co/kb/kalium/kalium-changelog/#version-<?php echo esc_attr( $changelog_entry['version'] ); ?>" target="_blank" rel="noreferrer noopener">
                        Read changelog
                    </a>
                </div>
            </li>
		<?php
            $i++;
		endforeach;
		?>
    </ul>

<?php endif; ?>

<?php
endif;
?>