<?php
/**
 * Updater file to update old options.
 *
 * @package updates
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

update_option( 'smart_post_show_pro_version', '4.0.1' );
update_option( 'smart_post_show_pro_db_version', '4.0.1' );

$old_blocks  = get_option( 'sp-pcp-blocks-setting-options' );
$old_modules = get_option( 'sp-pcp-blocks-modules-options' );

$new_blocks  = array(
	array(
		'block_name' => 'post-featured-image',
		'show'       => true,
	),
	array(
		'block_name' => 'post-next-previous',
		'show'       => true,
	),
	array(
		'block_name' => 'post-comment-count',
		'show'       => true,
	),
	array(
		'block_name' => 'archive-title',
		'show'       => true,
	),
	array(
		'block_name' => 'post-title',
		'show'       => true,
	),
	array(
		'block_name' => 'post-content',
		'show'       => true,
	),
	array(
		'block_name' => 'post-excerpt',
		'show'       => true,
	),
	array(
		'block_name' => 'post-reading-time',
		'show'       => true,
	),
	array(
		'block_name' => 'post-like-count',
		'show'       => true,
	),
	array(
		'block_name' => 'post-view-count',
		'show'       => true,
	),
	array(
		'block_name' => 'post-author-meta',
		'show'       => true,
	),
	array(
		'block_name' => 'post-meta',
		'show'       => true,
	),
	array(
		'block_name' => 'smart-post-tag',
		'show'       => true,
	),
	array(
		'block_name' => 'post-category',
		'show'       => true,
	),
	array(
		'block_name' => 'post-author-box',
		'show'       => true,
	),
	array(
		'block_name' => 'post-date-meta',
		'show'       => true,
	),
	array(
		'block_name' => 'post-breadcrumbs',
		'show'       => true,
	),
	array(
		'block_name' => 'post-social-share',
		'show'       => true,
	),
	array(
		'block_name' => 'post-comment',
		'show'       => true,
	),
);
$new_modules = array(
	array(
		'module_name' => 'template-library',
		'show'        => true,
	),
);

update_option( 'sp-pcp-blocks-setting-options', array_merge( $old_blocks, $new_blocks ) );
update_option( 'sp-pcp-blocks-modules-options', array_merge( $old_modules, $new_modules ) );
