Your IP : 216.73.216.162


Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/
Upload File :
Current File : /home/x/b/o/xbodynamge/namtation/wp-content/content-import.tar

class-hestia-import-utilities.php000066600000044401151126511340013164 0ustar00<?php
/**
 * Utilities methods used to import all three themes, Azera, Llorix, Parallax
 *
 * @package hestia
 * @since 1.1.49
 */

/**
 * Class Import_Utilities
 *
 * @access public
 * @since 1.1.49
 */
class Hestia_Import_Utilities {

	/**
	 * This function updates logo in hestia.
	 * In hestia logo control is returning attachment id while in A, P, L the logo is an url
	 *
	 * Note: A, P, L is short version of Azera, Parallax, Llorix.
	 *
	 * @param string $previous_theme_content Previous content.
	 *
	 * @access public
	 * @since 1.1.49
	 */
	public function update_logo( $previous_theme_content ) {
		// Don't set any logo if it's already set in hestia
		$current_logo = get_theme_mod( 'custom_logo' );
		if ( ! empty( $current_logo ) ) {
			return;
		}

		// Exit if there is no logo in A / P / L
		$logo_value = $previous_theme_content;
		if ( empty( $logo_value ) ) {
			return;
		}
		$logo_attachement_id = $this->get_attachment_id( $logo_value );
		if ( ! empty( $logo_attachement_id ) ) {
			set_theme_mod( 'custom_logo', $logo_attachement_id );
		}
	}

	/**
	 * Returns attachement id from an url.
	 *
	 * @param string $url Attachement url.
	 * @access public
	 * @since 1.1.49
	 *
	 * @return int|mixed
	 */
	private function get_attachment_id( $url ) {
		$attachment_id = 0;
		$dir           = wp_upload_dir();
		if ( false !== strpos( $url, $dir['baseurl'] . '/' ) ) { // Is URL in uploads directory?
			$file       = basename( $url );
			$query_args = array(
				'post_type'   => 'attachment',
				'post_status' => 'inherit',
				'fields'      => 'ids',
				'meta_query'  => array(
					array(
						'value'   => $file,
						'compare' => 'LIKE',
						'key'     => '_wp_attachment_metadata',
					),
				),
			);
			$query      = new WP_Query( $query_args );
			if ( $query->have_posts() ) {
				foreach ( $query->posts as $post_id ) {
					$meta                = wp_get_attachment_metadata( $post_id );
					$original_file       = basename( $meta['file'] );
					$cropped_image_files = wp_list_pluck( $meta['sizes'], 'file' );
					if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
						$attachment_id = $post_id;
						break;
					}
				}
				wp_reset_postdata();
			}
		}
		return $attachment_id;
	}

	/**
	 * Update sections order.
	 *
	 * @param string $previous_theme_content All settings from previous theme.
	 * @param array  $section_match Matching sections from previous theme and hestia.
	 * @access public
	 * @since 1.1.49
	 */
	public function update_sections_order( $previous_theme_content, $section_match ) {
		$result_order = array(
			'hestia_clients_bar'                => 10,
			'hestia_features'                   => 15,
			'hestia_about'                      => 20,
			'hestia_shop'                       => 25,
			'hestia_team'                       => 30,
			'hestia_testimonials'               => 35,
			'hestia_ribbon'                     => 40,
			'hestia_blog'                       => 45,
			'hestia_contact'                    => 50,
			'hestia_pricing'                    => 55,
			'sidebar-widgets-subscribe-widgets' => 60,
		);

		if ( empty( $previous_theme_content ) ) {
			set_theme_mod( 'sections_order', json_encode( $result_order ) );
			return;
		}

		// This means that it's a pro version of the theme we want to import
		$prev_oreder = json_decode( $previous_theme_content );
		if ( ! empty( $prev_oreder ) ) {
			foreach ( $section_match as $hestia_section => $imported_sction ) {
				$result_order[ $hestia_section ] = $prev_oreder->$imported_sction;
			}
		}
		set_theme_mod( 'sections_order', json_encode( $result_order ) );
	}


	/**
	 * Create Json for slider control in hestia.
	 *
	 * @param array $previous_theme_content All settings from previous theme.
	 * @access public
	 * @since 1.1.49
	 */
	public function update_big_title( $previous_theme_content, $settings ) {
		$hestia_slider_content = get_theme_mod( 'hestia_slider_content' );
		if ( ! empty( $hestia_slider_content ) ) {
			return;
		}

		$result = array();
		foreach ( $settings as $item => $name ) {
			if ( ! empty( $previous_theme_content[ $name ] ) ) {
				$result[ $item ] = $previous_theme_content[ $name ];
			}
		}

		if ( ! empty( $result ) ) {
			set_theme_mod( 'hestia_slider_content', '[' . json_encode( $result ) . ']' );
		}

	}

	/**
	 * Create html from about section add add it to about section content in hestia.
	 *
	 * @param array $about_content About content.
	 * @access public
	 * @since 1.1.49
	 */
	public function about_to_html( $about_content ) {

		$title  = ! empty( $about_content['title'] ) ? $about_content['title'] : '';
		$text   = ! empty( $about_content['text'] ) ? $about_content['text'] : '';
		$image  = ! empty( $about_content['image'] ) ? $about_content['image'] : '';
		$layout = ! empty( $about_content['layout'] ) ? $about_content['layout'] : '';

		$page_editor = get_theme_mod( 'hestia_page_editor' );
		$about_html  = ( ! empty( $page_editor ) ? $page_editor : '' );
		if ( ! empty( $title ) ) {
			$about_html .= '<h2>' . wp_kses_post( $title ) . '</h2>';
		}
		if ( ! empty( $text ) || ! empty( $image ) ) {

			$class_to_add = ( empty( $image ) ? 'col-md-12' : 'col-md-8' );
			$about_html  .= '<div class="row">';
			if ( $layout === 'about_layout2' ) {
				if ( ! empty( $image ) ) {
					$about_html .= '<div class="col-md-4 col-xs-12"><img src="' . esc_url( $image ) . '"/></div>';
				}
			}

			$about_html .= '<div class="' . esc_attr( $class_to_add ) . ' col-xs-12">';
			if ( ! empty( $text ) ) {
				$about_html .= wp_kses_post( $text );
			}
			$about_html .= '</div>';

			if ( $layout !== 'about_layout2' ) {
				if ( ! empty( $image ) ) {
					$about_html .= '<div class="col-md-4 col-xs-12"><img src="' . esc_url( $image ) . '"/></div>';
				}
			}

			$about_html .= '</div>';
		}

		if ( ! empty( $about_html ) ) {
			set_theme_mod( 'hestia_page_editor', $about_html );
			$this->sync_content_from_control( $about_html );
		}
	}

	/**
	 * Create html from contact section add add it to about section content in hestia.
	 *
	 * @param string $contact_content Section content.
	 * @access public
	 * @since 1.1.49
	 */
	public function contact_to_html( $contact_content ) {
		if ( empty( $contact_content ) ) {
			return;
		}
		$content = $this->update_icons( $contact_content );
		if ( ! empty( $content ) ) {
			$data = json_decode( $content, true );
			if ( ! empty( $data ) ) {
				$contact_html = '';
				foreach ( $data as $content_block ) {
					$contact_html .= '<div class="info info-horizontal">';
					if ( ! empty( $content_block['icon_value'] ) ) {
						$contact_html .= '<div class="icon icon-primary"><i class="fa ' . $content_block['icon_value'] . '"></i></div>';
					}
					if ( ! empty( $content_block['text'] ) ) {
						$contact_html .= '<div class="description">';
						if ( ! empty( $content_block['link'] ) ) {
							$contact_html .= '<a href="' . esc_url( $content_block['link'] ) . '">';
						}
						$contact_html .= '<h4 class="info-title">' . wp_kses_post( $content_block['text'] ) . '</h4>';
						if ( ! empty( $content_block['link'] ) ) {
							$contact_html .= '</a>';
						}
						$contact_html .= '</div>';
					}
					$contact_html .= '</div>';
				}

				if ( ! empty( $contact_html ) ) {
					set_theme_mod( 'hestia_contact_content_new', $contact_html );
				}
			}
		}

	}

	/**
	 * Parallax theme has stamp icons and font awesome while hestia has only font awesome. If a stamp icon is used,
	 * replace it with an icon form font awesome
	 *
	 * @param string $json Repeater content in json format.
	 * @access public
	 * @since 1.1.49
	 *
	 * @return string
	 */
	public function update_icons( $json ) {
		if ( empty( $json ) ) {
			return '';
		}

		$data = json_decode( $json, true );
		if ( ! empty( $data ) ) {
			foreach ( $data as $item => $values ) {
				if ( ! empty( $values['icon_value'] ) && strpos( $values['icon_value'], 'icon-' ) !== false ) {
					$data[ $item ]['icon_value'] = 'fa-circle-o';
				}
				if ( ! empty( $values['choice'] ) ) {
					if ( strpos( $values['choice'], '_icon' ) !== false ) {
						$data[ $item ]['choice'] = 'customizer_repeater_icon';
					}
					if ( strpos( $values['choice'], '_image' ) !== false ) {
						$data[ $item ]['choice'] = 'customizer_repeater_image';
					}
				}
				$color = get_theme_mod( 'accent_color' );
				if ( ! empty( $color ) ) {
					$data[ $item ]['color'] = $color;
				}
			}
		}
		return json_encode( $data );
	}

	/**
	 * Update Shop category control.
	 * In A, P, L shop categories are given by name while in Hestia we need its id
	 *
	 * @param string $shop_cat Shop category name.
	 * @access public
	 * @since 1.1.49
	 */
	public function update_shop_category( $shop_cat ) {
		if ( ! empty( $shop_cat ) ) {
			$category = get_term_by( 'slug', $shop_cat, 'product_cat' );
			if ( ! empty( $category ) && ! empty( $category->term_id ) ) {
				$cat_id = $category->term_id;
				if ( ! empty( $cat_id ) ) {
					set_theme_mod( 'hestia_shop_categories', array( $cat_id ) );
				}
			}
		}
	}

	/**
	 * Add content form features ribbon to html and add it to about section
	 *
	 * @param string $features_ribbon_content Section's content.
	 * @access public
	 * @since 1.1.49
	 */
	public function features_ribbon_to_html( $features_ribbon_content ) {

		if ( empty( $features_ribbon_content ) ) {
			return;
		}
		$page_editor = get_theme_mod( 'hestia_page_editor' );
		$ribbon_html = ( ! empty( $page_editor ) ? $page_editor : '' );

		$section_content = json_decode( $features_ribbon_content );
		if ( ! empty( $section_content ) ) {
			$i            = 1;
			$ribbon_html .= '<div class="row text-center" style="padding: 75px 0 55px;">';
			foreach ( $section_content as $ribbon_item ) {
				$choice       = ! empty( $ribbon_item->choice ) ? $ribbon_item->choice : 'parallax_icon';
				$icon         = ! empty( $ribbon_item->icon_value ) ? $ribbon_item->icon_value : '';
				$image        = ! empty( $ribbon_item->image_url ) ? $ribbon_item->image_url : '';
				$title        = ! empty( $ribbon_item->title ) ? $ribbon_item->title : '';
				$link         = ! empty( $ribbon_item->link ) ? $ribbon_item->link : '';
				$subtitle     = ! empty( $ribbon_item->subtitle ) ? $ribbon_item->subtitle : '';
				$ribbon_html .= '<div class="col-md-4"><div class="info hestia-info">';
				if ( ! empty( $link ) ) {
					$ribbon_html .= '<a href="' . esc_url( $link ) . '">';
				}

				if ( strpos( $choice, '_icon' ) !== false && ! empty( $icon ) ) {
					$ribbon_html .= '<div class="icon" style="color: #008ed6"><i class="fa ' . esc_attr( $icon ) . '"></i></div>';
				}
				if ( strpos( $choice, '_image' ) !== false && ! empty( $image ) ) {
					$ribbon_html .= '<div class="card card-plain" style="max-width: 100px;"><img src="' . esc_url( $image ) . '"/></div>';
				}

				if ( ! empty( $title ) ) {
					$ribbon_html .= '<h4 class="info-title">' . esc_html( $title ) . '</h4>';
				}

				if ( ! empty( $link ) ) {
					$ribbon_html .= '</a>';
				}

				if ( ! empty( $subtitle ) ) {
					$ribbon_html .= '<p>' . wp_kses_post( html_entity_decode( $subtitle ) ) . '</p>';
				}

				$ribbon_html .= '</div></div>';
				if ( $i % 3 == 0 ) {
					$ribbon_html .= '</div>';
					$ribbon_html .= '<div class="row">';
				}
				$i++;
			}
			$ribbon_html .= '</div>';
		}

		if ( ! empty( $ribbon_html ) ) {
			set_theme_mod( 'hestia_page_editor', $ribbon_html );
			$this->sync_content_from_control( $ribbon_html );
		}
	}

	/**
	 * Add content form shortcodes section to html and add it to about section
	 *
	 * @param string $shortcodes_content Section's content.
	 * @access public
	 * @since 1.1.49
	 */
	public function shortcodes_section_to_html( $shortcodes_content ) {

		$execute = get_option( 'should_import_zerif_shortcodes' );
		if ( $execute !== false ) {
			return;
		}

		if ( empty( $shortcodes_content ) ) {
			return;
		}
		$page_editor     = get_theme_mod( 'hestia_page_editor' );
		$shortcode_html  = ( ! empty( $page_editor ) ? $page_editor : '' );
		$section_content = json_decode( $shortcodes_content );
		if ( ! empty( $section_content ) && is_array( $section_content ) ) {
			foreach ( $section_content as $shortcode_section ) {
				$title     = ( ! empty( $shortcode_section->title ) ? $shortcode_section->title : '' );
				$subtitle  = ( ! empty( $shortcode_section->subtitle ) ? $shortcode_section->subtitle : '' );
				$shortcode = ( ! empty( $shortcode_section->shortcode ) ? $shortcode_section->shortcode : '' );

				$shortcode_html .= '<section class="shortcode">';

				if ( ! empty( $title ) || ! empty( $subtitle ) ) {
					$shortcode_html .= '<div class="row"><div class="col-md-8 col-md-offset-2 text-center">';
					if ( ! empty( $title ) ) {
						$shortcode_html .= '<h2 class="hestia-title">' . wp_kses_post( $title ) . '</h2>';
					}

					if ( ! empty( $subtitle ) ) {
						$shortcode_html .= '<h5 class="description">' . wp_kses_post( $subtitle ) . '</h5>';
					}
					$shortcode_html .= '</div></div>';
				}

				if ( ! empty( $shortcode ) ) {
					$shortcode_html .= '<div class="shortcode-content"><div class="row"><div class="col-md-12">' . $shortcode . '</div></div></div>';
				}

				$shortcode_html .= '</section>';

				if ( ! empty( $shortcode_html ) ) {
					set_theme_mod( 'hestia_page_editor', $shortcode_html );
					$this->sync_content_from_control( $shortcode_html );
				}
			}
		}

		update_option( 'should_import_zerif_shortcodes', true );

	}

	/**
	 * Remove sidebars if full width is checked in imported theme.
	 *
	 * @param bool $full_width_option Full width option.
	 * @access public
	 * @since 1.1.49
	 */
	public function update_layout( $full_width_option ) {
		if ( (bool) $full_width_option === true ) {
			set_theme_mod( 'hestia_page_sidebar_layout', 'full-width' );
			set_theme_mod( 'hestia_blog_sidebar_layout', 'full-width' );
		}
	}

	/**
	 * Update nav menus.
	 *
	 * @param string $footer_socials_content Footer socials.
	 * @param string $nav_locations Old nav locations.
	 * @access public
	 * @since 1.1.49
	 */
	public function update_menus( $footer_socials_content, $nav_locations ) {
		$theme_navs = get_theme_mod( 'nav_menu_locations' );
		if ( empty( $theme_navs['primary'] ) && ! empty( $nav_locations['primary'] ) ) {
			$theme_navs['primary'] = $nav_locations['primary'];
		}

		if ( empty( $theme_navs['footer'] ) && ! empty( $nav_locations['parallax_footer_menu'] ) ) {
			$theme_navs['footer'] = $nav_locations['parallax_footer_menu'];
		}

		if ( empty( $theme_navs['top-bar-menu'] ) && ! empty( $footer_socials_content ) ) {

			$menu_name   = 'Header socials menu';
			$menu_exists = wp_get_nav_menu_object( $menu_name );
			if ( ! $menu_exists ) {
				$menu_id     = wp_create_nav_menu( $menu_name );
				$icons_array = json_decode( $footer_socials_content );
				if ( ! empty( $icons_array ) && is_array( $icons_array ) ) {
					foreach ( $icons_array as $social ) {
						if ( ! empty( $social->link ) ) {
							wp_update_nav_menu_item(
								$menu_id, 0, array(
									'menu-item-title'  => 'Custom Page',
									'menu-item-url'    => $social->link,
									'menu-item-status' => 'publish',
								)
							);
						}
					}
				}
				$theme_navs['top-bar-menu'] = $menu_id;
				set_theme_mod( 'hestia_top_bar_hide', false );
			}
		}
		set_theme_mod( 'nav_menu_locations', $theme_navs );
	}

	/**
	 * Move widgets from old sidebars to hestia's sidebars
	 *
	 * @access public
	 * @since 1.1.49
	 */
	public function update_sidebars() {
		$widgets_from_old_theme = wp_get_sidebars_widgets();
		$new_widget_array       = array();

		if ( ! empty( $widgets_from_old_theme['sidebar-1'] ) ) {
			$new_widget_array['sidebar-1'] = $widgets_from_old_theme['sidebar-1'];
		}

		if ( ! empty( $widgets_from_old_theme['footer-area'] ) ) {
			$new_widget_array['footer-one-widgets'] = $widgets_from_old_theme['footer-area'];
		}

		if ( ! empty( $widgets_from_old_theme['footer-area-2'] ) ) {
			$new_widget_array['footer-two-widgets'] = $widgets_from_old_theme['footer-area-2'];
		}

		if ( ! empty( $widgets_from_old_theme['footer-area-3'] ) || ! empty( $widgets_from_old_theme['footer-area-4'] ) ) {
			$footer_3_content = array();
			if ( ! empty( $widgets_from_old_theme['footer-area-3'] ) ) {
				$footer_3_content = array_merge( $footer_3_content, $widgets_from_old_theme['footer-area-3'] );
			}
			if ( ! empty( $widgets_from_old_theme['footer-area-4'] ) ) {
				$footer_3_content = array_merge( $footer_3_content, $widgets_from_old_theme['footer-area-4'] );
			}
			$new_widget_array['footer-three-widgets'] = $footer_3_content;
		}

		if ( ! isset( $new_widget_array['wp_inactive_widgets'] ) ) {
			$new_widget_array['wp_inactive_widgets'] = array();
		}

		update_option( 'sidebars_widgets', $new_widget_array );
	}

	/**
	 * Update header layout.
	 *
	 * @param string $header_layout Header layout.
	 * @access public
	 * @since 1.1.49
	 */
	public function update_header_layout( $header_layout ) {
		if ( $header_layout === 'layout2' ) {
			set_theme_mod( 'hestia_slider_alignment', 'left' );
		}
	}

	/**
	 * Moves portfolios posts from Parallax cpt portfolio to Jetpack portfolio cpt.
	 *
	 * @param string $post_type Name of the cpt.
	 * @access public
	 * @since 1.1.51
	 */
	public function update_portfolio( $post_type ) {
		if ( ! class_exists( 'Jetpack' ) || ! ( Jetpack::is_module_active( 'custom-content-types' ) ) ) {
			return;
		}

		$post = new WP_Query(
			array(
				'post_type' => $post_type,
			)
		);
		if ( $post->have_posts() ) {
			while ( $post->have_posts() ) {
				$post->the_post();

				$pid = get_the_ID();

				/* Create post */
				$title   = get_the_title();
				$content = get_the_content();
				$post_id = wp_insert_post(
					array(
						'post_type'    => 'jetpack-portfolio',
						'post_title'   => $title,
						'post_content' => $content,
						'post_status'  => 'publish',
					)
				);

				/* Update post thumbnail */
				$post_thumbnail_id = get_post_thumbnail_id( $pid );
				if ( ! empty( $post_id ) && ! empty( $post_thumbnail_id ) ) {
					update_post_meta( $post_id, '_thumbnail_id', $post_thumbnail_id );
				}
			}
			wp_reset_postdata();
		}
	}

	/**
	 * Sync frontpage content with customizer control
	 *
	 * @param string $value New value.
	 */
	protected function sync_content_from_control( $value ) {
		$frontpage_id = get_option( 'page_on_front' );
		if ( ! empty( $frontpage_id ) && ! empty( $value ) ) {
			if ( ! wp_is_post_revision( $frontpage_id ) ) {
				// update the post, which calls save_post again
				$post = array(
					'ID'           => $frontpage_id,
					'post_content' => wp_kses_post( $value ),
				);
				wp_update_post( $post );
			}
		}
	}
}
class-hestia-content-import.php000066600000040247151126511340012627 0ustar00<?php
/**
 * Hestia import handler.
 *
 * @package Hestia
 * @since   1.1.49
 */

/**
 * Class Hestia_Content_Import
 *
 * Handles content import from Azera, Llorix and Parallax One.
 */
final class Hestia_Content_Import {

	/**
	 * Previous theme slug
	 *
	 * @var mixed|string|void
	 */
	private $previous_theme = '';

	/**
	 * Simple theme mods
	 *
	 * @var array
	 */
	private $simple_theme_mods = array(

		// Big title
		'hestia_big_title_title'       => 'header_title',
		'hestia_big_title_text'        => 'header_subtitle',
		'hestia_big_title_button_text' => 'header_button_text',
		'hestia_big_title_button_link' => 'header_button_link',

		// Logos section
		'hestia_clients_bar_hide'      => 'logos_show',
		'hestia_clients_bar_content'   => 'logos_content',

		// Ribbon section
		'hestia_ribbon_hide'           => 'ribbon_show',
		'hestia_ribbon_text'           => 'ribbon_title',
		'hestia_ribbon_button_text'    => 'button_text',
		'hestia_ribbon_button_url'     => 'button_link',

		// Contact subtitle
		'hestia_contact_subtitle'      => 'copyright',

		// Features section
		'hestia_features_hide'         => 'our_services_show',
		'hestia_features_title'        => 'our_services_title',
		'hestia_features_subtitle'     => 'our_services_subtitle',

		// About section
		'hestia_about_hide'            => 'our_story_show',

		// Team section
		'hestia_team_hide'             => 'our_team_show',
		'hestia_team_title'            => 'our_team_title',
		'hestia_team_subtitle'         => 'our_team_subtitle',
		'hestia_team_content'          => 'team_content',

		// Testimonials
		'hestia_testimonials_hide'     => 'happy_customers_show',
		'hestia_testimonials_title'    => 'happy_customers_title',
		'hestia_testimonials_subtitle' => 'happy_customers_subtitle',
		'hestia_testimonials_content'  => 'testimonials_content',

		// Portfolio
		'hestia_portfolio_title'       => 'plus_portfolio_section_title',
		'hestia_portfolio_subtitle'    => 'plus_portfolio_section_subtitle',
		'hestia_portfolio_items'       => 'plus_number_of_portfolio_posts',

		// Shop
		'hestia_shop_hide'             => 'shop_section_show',

		// Copyright
		'hestia_general_credits'       => 'pwd',
	);

	/**
	 * Previous theme content
	 *
	 * @var array
	 */
	private $previous_theme_content = array();

	/**
	 * Hestia_Content_Import constructor.
	 *
	 * @access public
	 * @since  1.1.49
	 */
	public function __construct() {

		// Get the name of the previously active theme.
		$this->previous_theme = strtolower( get_option( 'theme_switched' ) );

		// Get the theme mods from the previous theme.
		$this->previous_theme_content = get_option( 'theme_mods_' . $this->previous_theme );

	}

	/**
	 * Main import handler function.
	 *
	 * @access private
	 * @since  1.1.49
	 */
	public final function import() {

		if ( ! in_array( $this->previous_theme, array( 'azera-shop', 'parallax-one', 'llorix-one-lite' ) ) ) {
			return;
		}
		// Prefix the theme mods with the previously active theme slug.
		$this->prefix_theme_mods( $this->simple_theme_mods );

		// Add exceptions.
		$this->add_exceptions();

		// Set all mods in the $simple_theme_mods array.
		$this->set_simple_mods( $this->simple_theme_mods );

		// Import content.
		$this->import_content();

	}

	/**
	 * Prefix theme mods.
	 *
	 * @param theme -mods $mods theme mods array.
	 *
	 * @access private
	 * @since  1.1.49
	 */
	private final function prefix_theme_mods( $mods ) {
		$prefix = str_replace( '-', '_', $this->previous_theme ) . '_';
		if ( ! empty( $mods ) ) {
			foreach ( $mods as $hestia_mod => $previous_mod_unprefixed ) {
				$this->simple_theme_mods[ $hestia_mod ] = $prefix . $previous_mod_unprefixed;
			}
		}

	}

	/**
	 * Add exceptions || remove unused settings.
	 *
	 * Add exceptions and bail if the previous theme was not Azera, Parallax or Llorix,
	 *
	 * @access private
	 * @since  1.1.49
	 */
	private final function add_exceptions() {
		// Add exceptions and bail if there's another theme than these three.
		switch ( $this->previous_theme ) {
			case 'azera-shop':
				$this->azera_specific_changes();

				$theme_exceptions        = array(
					'hestia_big_title_background' => 'header_image',
					'hestia_ribbon_background'    => 'azera_shop_ribbon_background',
					'hestia_shop_title'           => 'azera_shop_shop_section_title',
					'hestia_shop_subtitle'        => 'azera_shop_shop_section_subtitle',
					'hestia_shop_items'           => 'azera_shop_number_of_products',
				);
				$this->simple_theme_mods = array_merge( $this->simple_theme_mods, $theme_exceptions );
				break;
			case 'parallax-one':
				$this->parallax_specific_changes();
				$theme_exceptions        = array(
					'hestia_big_title_background' => 'header_image',
					'hestia_ribbon_background'    => 'paralax_one_ribbon_background',
					'hestia_shop_title'           => 'parallax_one_plus_shop_section_title',
					'hestia_shop_subtitle'        => 'parallax_one_plus_shop_section_subtitle',
					'hestia_shop_items'           => 'parallax_one_plus_number_of_products',
					'hestia_blog_title'           => 'parallax_one_latest_news_title',
				);
				$this->simple_theme_mods = array_merge( $this->simple_theme_mods, $theme_exceptions );
				break;
			case 'llorix-one-lite':
				$this->llorix_specific_changes();
				$theme_exceptions        = array(
					'hestia_big_title_background' => 'header_image',
					'hestia_ribbon_background'    => 'llorix_one_lite_ribbon_background',
					'hestia_shop_title'           => 'llorix_one_plus_shop_section_title',
					'hestia_shop_subtitle'        => 'llorix_one_plus_shop_section_subtitle',
					'hestia_shop_items'           => 'llorix_one_plus_number_of_products',
					'hestia_blog_title'           => 'llorix_one_lite_latest_news_title',
				);
				$this->simple_theme_mods = array_merge( $this->simple_theme_mods, $theme_exceptions );
				break;
		}
	}


	/**
	 * Import content from previous theme.
	 *
	 * @access private
	 * @since  1.1.49
	 */
	private function import_content() {

		require_once( HESTIA_PHP_INCLUDE . 'content-import/class-hestia-import-utilities.php' );
		$utilities = new Hestia_Import_Utilities();

		$prefix = str_replace( '-', '_', $this->previous_theme ) . '_';

		/**
		 * Import logo.
		 */
		$logo_id = $prefix === 'parallax_one_' ? 'paralax_one_logo' : $prefix . 'logo';
		if ( ! empty( $this->previous_theme_content[ $logo_id ] ) ) {
			$utilities->update_logo( $this->previous_theme_content[ $logo_id ] );
		}

		/**
		 * Enable Clients bar section if user have content in it in previous theme.
		 */
		$clients_hide = get_theme_mod( 'hestia_clients_bar_hide' );
		if ( ! empty( $this->previous_theme_content[ $prefix . 'logos_content' ] ) && empty( $clients_hide ) ) {
			set_theme_mod( 'hestia_clients_bar_hide', false );
		}

		/**
		 * Enable ribbon section if user have content in it in previous theme.
		 */
		$ribbon_hide = get_theme_mod( 'hestia_ribbon_hide' );
		if ( ( ! empty( $this->previous_theme_content[ $prefix . 'ribbon_title' ] ) || ! empty( $this->previous_theme_content[ $prefix . 'button_text' ] ) ) && empty( $ribbon_hide ) ) {
			set_theme_mod( 'hestia_ribbon_hide', false );
		}

		/**
		 * Features content. Check if it contains stamp icons, replace them and update content in hestia.
		 */
		if ( ! empty( $this->previous_theme_content[ $prefix . 'services_content' ] ) ) {
			$json = $utilities->update_icons( $this->previous_theme_content[ $prefix . 'services_content' ] );
			if ( ! empty( $json ) ) {
				set_theme_mod( 'hestia_features_content', $json );
			}
		}

		/**
		 * Shop section.
		 */
		$woo_cat_control_id = $prefix . 'woocomerce_categories';
		switch ( $prefix ) {
			case 'llorix_one_lite_':
				$woo_cat_control_id = 'llorix_one_plus_woocomerce_categories';
				break;
			case 'parallax_one_':
				$woo_cat_control_id = 'parallax_one_plus_woocomerce_categories';
				break;
		}
		if ( ! empty( $this->previous_theme_content[ $woo_cat_control_id ] ) ) {
			$utilities->update_shop_category( $this->previous_theme_content[ $woo_cat_control_id ] );
		}

		/**
		 * Shortcodes section.
		 */
		if ( ( empty( $this->previous_theme_content[ $prefix . 'shortcodes_section_show' ] ) || (bool) $this->previous_theme_content[ $prefix . 'shortcodes_section_show' ] !== true ) && ! empty( $this->previous_theme_content[ $prefix . 'shortcodes_settings' ] ) ) {
			$utilities->shortcodes_section_to_html( $this->previous_theme_content[ $prefix . 'shortcodes_settings' ] );
		}

		/**
		 * Contact section.
		 */
		if ( ( empty( $this->previous_theme_content[ $prefix . 'contact_info_show' ] ) || (bool) $this->previous_theme_content[ $prefix . 'contact_info_show' ] !== true ) && ! empty( $this->previous_theme_content[ $prefix . 'contact_info_content' ] ) ) {
			$utilities->contact_to_html( $this->previous_theme_content[ $prefix . 'contact_info_content' ] );
		}

		/**
		 * About section.
		 */
		$settings = array();
		if ( ! empty( $this->previous_theme_content[ $prefix . 'our_story_title' ] ) ) {
			$settings['title'] = $this->previous_theme_content[ $prefix . 'our_story_title' ];
		};

		if ( ! empty( $this->previous_theme_content[ $prefix . 'our_story_text' ] ) ) {
			$settings['text'] = $this->previous_theme_content[ $prefix . 'our_story_text' ];
		};

		if ( ! empty( $this->previous_theme_content[ $prefix . 'our_story_image' ] ) ) {
			$settings['image'] = $this->previous_theme_content[ $prefix . 'our_story_image' ];
		};
		$layout_control = '';
		switch ( $prefix ) {
			case 'llorix_one_lite_':
				$layout_control = 'llorix_one_plus_about_layout';
				break;
			case 'parallax_one_':
				$layout_control = 'parallax_one_plus_about_layout';
				break;
			case 'azera_shop_':
				$layout_control = 'azera_shop_plus_about_layout';
				break;
		}
		if ( ! empty( $layout_control ) && ! empty( $this->previous_theme_content[ $layout_control ] ) ) {
			$settings['layout'] = $this->previous_theme_content[ $layout_control ];
		};
		$utilities->about_to_html( $settings );

		/**
		 * Move portfolio from cpt to jetpack's cpt.
		 */
		$utilities->update_portfolio( 'portfolio' );
		/**
		 * Sidebars.
		 */
		$utilities->update_sidebars();

		/**
		 * Features ribbon section.
		 */
		if ( ! empty( $this->previous_theme_content[ $prefix . 'features_ribbon_content' ] ) ) {
			$utilities->features_ribbon_to_html( $this->previous_theme_content[ $prefix . 'features_ribbon_content' ] );
		}

		/**
		 * Create Json for slider control in hestia
		 */
		$settings = array(
			'title'     => $prefix . 'header_title',
			'subtitle'  => $prefix . 'header_subtitle',
			'text'      => $prefix . 'header_button_text',
			'link'      => $prefix . 'header_button_link',
			'image_url' => 'header_image',
		);
		$utilities->update_big_title( $this->previous_theme_content, $settings );

		/**
		 * Full width layout
		 */
		if ( ! empty( $this->previous_theme_content[ $prefix . 'full_width_template' ] ) ) {
			$utilities->update_layout( $this->previous_theme_content[ $prefix . 'full_width_template' ] );
		}

		/**
		 * Update sections order
		 */
		$section_match  = array(
			'hestia_clients_bar'  => $prefix . 'logos_settings_section',
			'hestia_features'     => $prefix . 'services_section',
			'hestia_about'        => $prefix . 'about_section',
			'hestia_shop'         => $prefix . 'shop_section',
			'hestia_team'         => $prefix . 'team_section',
			'hestia_portfolio'    => $prefix . 'portfolio_section',
			'hestia_testimonials' => $prefix . 'testimonials_section',
			'hestia_ribbon'       => $prefix . 'ribbon_section',
			'hestia_blog'         => $prefix . 'latest_news_section',
			'hestia_contact'      => $prefix . 'contact_section',
		);
		$sections_order = ( ! empty( $this->previous_theme_content['sections_order'] ) ? $this->previous_theme_content['sections_order'] : '' );
		$utilities->update_sections_order( $sections_order, $section_match );

		/**
		 * Header layout
		 */
		$layout = $prefix === 'azera_shop_' ? 'layout2' : '';
		if ( ! empty( $this->previous_theme_content[ $prefix . 'header_layout' ] ) ) {
			$utilities->update_header_layout( $this->previous_theme_content[ $prefix . 'header_layout' ] );
		} elseif ( ! empty( $layout ) ) {
			$utilities->update_header_layout( $layout );
		}

		/* Menus */
		if ( ! empty( $this->previous_theme_content['nav_menu_locations'] ) ) {
			if ( $prefix === 'llorix_one_lite_' ) {
				$social_content = ! empty( $this->previous_theme_content['llorix_one_lite_very_top_social_icons'] ) ? $this->previous_theme_content['llorix_one_lite_very_top_social_icons'] : '';
			} else {
				$social_content = ! empty( $this->previous_theme_content[ $prefix . 'social_icons' ] ) ? $this->previous_theme_content[ $prefix . 'social_icons' ] : '';
			}
			$utilities->update_menus( $social_content, $this->previous_theme_content['nav_menu_locations'] );
		}

	}

	/**
	 * Sets all the simple theme mods provided in the parameter array.
	 *
	 * @param theme -mods $mods theme mods array.
	 *
	 * @access private
	 * @since  1.1.49
	 */
	private function set_simple_mods( $mods ) {
		// Prefix the theme mods with the previous active theme name and set them in Hestia.
		if ( ! empty( $mods ) ) {
			foreach ( $mods as $hestia_mod => $imported_mod ) {
				$this->set_hestia_mod( $hestia_mod, $imported_mod );
			}
		}
	}

	/**
	 * Utility method to set theme mod from import.
	 *
	 * @param  hestia-mod-id   $hestia_mod_id the hestia mod to set.
	 * @param  imported-mod-id $imported_mod_id the imported theme mod id.
	 *
	 * @access private
	 * @since  1.1.49
	 */
	private final function set_hestia_mod( $hestia_mod_id, $imported_mod_id ) {
		$hestia_mod = get_theme_mod( $hestia_mod_id );
		if ( ! empty( $this->previous_theme_content[ $imported_mod_id ] ) ) {
			$imported_mod = $this->previous_theme_content[ $imported_mod_id ];
			if ( ! empty( $imported_mod ) && empty( $hestia_mod ) ) {
				set_theme_mod( $hestia_mod_id, $imported_mod );
			}
		}
	}

	/**
	 * Do specific actions for Llorix theme.
	 *
	 * @access private
	 * @since  1.1.49
	 */
	private function llorix_specific_changes() {

		/* Set fonts */
		set_theme_mod( 'hestia_headings_font', 'Cabin' );
		set_theme_mod( 'hestia_body_font', 'Cabin' );

		/* Set default color */
		set_theme_mod( 'accent_color', '#be5000' );
		set_theme_mod( 'secondary_color', '#0d3c55' );
		if ( ! empty( $previous_theme_content['llorix_one_lite_title_color'] ) ) {
			set_theme_mod( 'body_color', $previous_theme_content['llorix_one_lite_title_color'] );
		}
		if ( ! empty( $previous_theme_content['llorix_one_lite_text_color'] ) ) {
			set_theme_mod( 'secondary_color', $previous_theme_content['llorix_one_lite_text_color'] );
		}

	}


	/**
	 * Do specific actions for Azera theme.
	 *
	 * @access private
	 * @since  1.1.49
	 */
	private function azera_specific_changes() {

		/* Set fonts */
		set_theme_mod( 'hestia_headings_font', 'Cabin' );
		set_theme_mod( 'hestia_body_font', 'Cabin' );

		/* Set default color */
		set_theme_mod( 'accent_color', '#FFA200' );

		/* Static front page settings */
		if ( 'page' === get_option( 'show_on_front' ) ) {
			$pid = $this->create_frontpage();
			update_option( 'page_on_front', $pid );
		}
	}

	/**
	 * Do modifications for parallax that needs some logic.
	 *
	 * @access private
	 * @since  1.1.49
	 */
	private function parallax_specific_changes() {
		/* Set fonts */
		set_theme_mod( 'hestia_headings_font', 'Cabin' );
		set_theme_mod( 'hestia_body_font', 'Cabin' );

		/* Set default color */
		set_theme_mod( 'accent_color', '#008ed6' );

		/* Shop section visibility */
		if ( ! empty( $previous_theme_content['parallax_one_shop_section_show'] ) ) {
			set_theme_mod( 'hestia_shop_hide', (bool) $previous_theme_content['parallax_one_shop_section_show'] );
		} else {
			set_theme_mod( 'hestia_shop_hide', true );
		}

		/* Static front page settings */
		if ( 'posts' === get_option( 'show_on_front' ) ) {
			$pid = $this->create_frontpage();
			update_option( 'show_on_front', 'page' );
			update_option( 'page_on_front', $pid );
		}
	}

	/**
	 * Create the frontpage from previous themes ( azera/llorix/paralax) and returns its id.
	 */
	private function create_frontpage() {
		$about_content = get_theme_mod( 'hestia_page_editor' );
		$page_content  = ! empty( $about_content ) ? $about_content : '';
		$page          = array(
			'post_type'    => 'page',
			'post_title'   => 'Front page',
			'post_content' => wp_kses_post( $page_content ),
			'post_status'  => 'publish',
			'post_author'  => 1,
		);
		$pid           = wp_insert_post( $page );

		return $pid;
	}
}
class-hestia-import-zerif.php000066600000104421151126511340012267 0ustar00<?php
/**
 * Class used to import zerif.
 *
 * @package hestia
 * @since 1.1.51
 */

/**
 * Class Hestia_Import_Zerif
 */
class Hestia_Import_Zerif extends Hestia_Import_Utilities {

	/**
	 * Previous theme slug
	 *
	 * @var mixed|string|void
	 */
	private $previous_theme = '';

	/**
	 * Previous theme content
	 *
	 * @var array
	 */
	private $previous_theme_content = array();

	/**
	 * Match customizer options between Zerif and Hestia
	 *
	 * @var array
	 */
	private $match_controls = array(
		'hestia_features_hide'         => 'zerif_ourfocus_show',
		'hestia_features_title'        => 'zerif_ourfocus_title',
		'hestia_features_subtitle'     => 'zerif_ourfocus_subtitle',
		'hestia_team_hide'             => 'zerif_ourteam_show',
		'hestia_team_title'            => 'zerif_ourteam_title',
		'hestia_team_subtitle'         => 'zerif_ourteam_subtitle',
		'hestia_testimonials_hide'     => 'zerif_testimonials_show',
		'hestia_testimonials_title'    => 'zerif_testimonials_title',
		'hestia_testimonials_subtitle' => 'zerif_testimonials_subtitle',
		'hestia_clients_bar_hide'      => 'zerif_aboutus_show',
		'hestia_pricing_title'         => 'zerif_packages_title',
		'hestia_pricing_subtitle'      => 'zerif_packages_subtitle',
		'custom_logo'                  => 'custom_logo',
		'hestia_portfolio_title'       => 'zerif_portofolio_title',
		'hestia_portfolio_subtitle'    => 'zerif_portofolio_subtitle',
		'hestia_portfolio_items'       => 'zerif_portofolio_number',
		'hestia_portfolio_hide'        => 'zerif_portofolio_show',
		'hestia_ribbon_text'           => 'zerif_ribbonright_text',
		'hestia_ribbon_button_text'    => 'zerif_ribbonright_buttonlabel',
		'hestia_ribbon_button_url'     => 'zerif_ribbonright_buttonlink',
		'hestia_contact_title'         => 'zerif_contactus_title',
		'hestia_contact_subtitle'      => 'zerif_contactus_subtitle',
		'hestia_general_credits'       => 'zerif_copyright',
		'hestia_blog_title'            => 'zerif_latestnews_title',
		'hestia_blog_subtitle'         => 'zerif_latestnews_subtitle',
		'hestia_parallax_layer1'       => 'zerif_parallax_img1',
		'hestia_parallax_layer2'       => 'zerif_parallax_img2',
	);

	/**
	 * Hestia_Import_Zerif constructor.
	 *
	 * @access public
	 * @since 1.1.51
	 */
	public function __construct() {

		// Get the name of the previously active theme.
		$this->previous_theme = strtolower( get_option( 'theme_switched' ) );

		// Get the theme mods from the previous theme.
		$this->previous_theme_content = get_option( 'theme_mods_' . $this->previous_theme );

	}

	/**
	 * Main import handler function.
	 *
	 * @access private
	 * @since 1.1.51
	 */
	public final function import() {
		if ( ! in_array( $this->previous_theme, array( 'zerif-pro', 'zerif-lite', 'zblackbeard', 'responsiveboat' ) ) ) {
			return;
		}

		/* Set fonts */
		set_theme_mod( 'hestia_headings_font', 'Montserrat' );
		set_theme_mod( 'hestia_body_font', 'Montserrat' );
		set_theme_mod( 'hestia_general_layout', false );

		/* Set default color */
		set_theme_mod( 'accent_color', '#e96656' );

		if ( $this->previous_theme === 'zerif-pro' ) {
			/* Static front page settings */
			if ( 'posts' === get_option( 'show_on_front' ) ) {
				$about_content = get_theme_mod( 'hestia_page_editor' );
				$page_content  = ! empty( $about_content ) ? $about_content : '';
				$page          = array(
					'post_type'    => 'page',
					'post_title'   => 'Front page',
					'post_content' => wp_kses_post( $page_content ),
					'post_status'  => 'publish',
					'post_author'  => 1,
				);
				$pid           = wp_insert_post( $page );
				update_option( 'show_on_front', 'page' );
				update_option( 'page_on_front', $pid );
			}
			$this->import_section_order();
		}

		if ( $this->previous_theme === 'zerif-lite' ) {
			$this->match_controls['hestia_features_title'] = 'zerif_ourfocus_title_2';
		}

		// Set all mods in the $simple_theme_mods array.
		$this->set_simple_mods();

		$this->import_zerif_parallax();

		$this->import_zerif_header();

		$this->widgets_to_theme_mods();

		$this->import_zerif_packages();

		$this->import_zerif_about();

		// Import portfolios
		require_once( HESTIA_PHP_INCLUDE . 'content-import/class-hestia-import-utilities.php' );
		$utilities = new Hestia_Import_Utilities();

		if ( empty( $this->previous_theme_content['zerif_portofolio_show'] ) || (bool) $this->previous_theme_content['zerif_portofolio_show'] === false ) {
			set_theme_mod( 'hestia_portfolio_hide', false );
		}
		$utilities->update_portfolio( 'portofolio' );

		// Import bottom button ribon to about
		$this->import_zerif_bottom_button_ribbon();

		// Show ribbon section if it's visible in zerif
		if ( ! empty( $this->previous_theme_content['zerif_ribbonright_text'] ) || ! empty( $this->previous_theme_content['zerif_ribbonright_buttonlabel'] ) ) {
			set_theme_mod( 'hestia_ribbon_hide', false );
		}

		// Import shortcode section
		if ( isset( $this->previous_theme_content['zerif_shortcodes_settings'] ) ) {
			$utilities->shortcodes_section_to_html( $this->previous_theme_content['zerif_shortcodes_settings'] );
		}
		// Import footer to contact section
		$this->import_zerif_footer();

		// Import footer social in footer menu
		$this->import_zerif_footer_socials();

		// Update sidebars
		$this->import_sidebars();

		// Import menus
		$this->import_menus();

	}

	/**
	 * Import parallax from zerif to hestia.
	 */
	private function import_zerif_parallax() {
		if ( ! array_key_exists( 'zerif_parallax_show', $this->previous_theme_content ) ) {
			return;
		}
		$zerif_parallax_use = $this->previous_theme_content['zerif_parallax_show'];
		if ( ! empty( $zerif_parallax_use ) && ( $zerif_parallax_use == 1 ) ) {
			set_theme_mod( 'hestia_slider_type', 'parallax' );
		}

	}

	/**
	 * Create Json for slider control in hestia
	 *
	 * @access private
	 * @since 1.1.51
	 */
	private function import_zerif_header() {
		// This is the main structure of a slide. In zerif all slides have same content but different background.
		$main_slide = array();
		if ( ! empty( $this->previous_theme_content['zerif_bigtitle_title'] ) ) {
			$main_slide['title'] = wp_kses_post( $this->previous_theme_content['zerif_bigtitle_title'] );
		} elseif ( ! empty( $this->previous_theme_content['zerif_bigtitle_title_2'] ) ) {
			$main_slide['title'] = wp_kses_post( $this->previous_theme_content['zerif_bigtitle_title_2'] );
		}

		if ( ! empty( $this->previous_theme_content['zerif_bigtitle_redbutton_label'] ) ) {
			$main_slide['text'] = wp_kses_post( $this->previous_theme_content['zerif_bigtitle_redbutton_label'] );
		} elseif ( ! empty( $this->previous_theme_content['zerif_bigtitle_redbutton_label_2'] ) ) {
			$main_slide['text'] = wp_kses_post( $this->previous_theme_content['zerif_bigtitle_redbutton_label_2'] );
		}

		if ( ! empty( $this->previous_theme_content['zerif_bigtitle_redbutton_url'] ) ) {
			$main_slide['link'] = esc_url( $this->previous_theme_content['zerif_bigtitle_redbutton_url'] );
		}
		if ( ! empty( $this->previous_theme_content['zerif_bigtitle_greenbutton_label'] ) ) {
			$main_slide['text2'] = wp_kses_post( $this->previous_theme_content['zerif_bigtitle_greenbutton_label'] );
		}
		if ( ! empty( $this->previous_theme_content['zerif_bigtitle_greenbutton_url'] ) ) {
			$main_slide['link2'] = esc_url( $this->previous_theme_content['zerif_bigtitle_greenbutton_url'] );
		}
		if ( ! empty( $this->previous_theme_content['zerif_bigtitle_1button_background_color'] ) ) {
			$main_slide['color'] = wp_kses_post( $this->previous_theme_content['zerif_bigtitle_1button_background_color'] );
		} else {
			$main_slide['color'] = '#e96656';
		}
		if ( ! empty( $this->previous_theme_content['zerif_bigtitle_2button_background_color'] ) ) {
			$main_slide['color2'] = wp_kses_post( $this->previous_theme_content['zerif_bigtitle_2button_background_color'] );
		} else {
			$main_slide['color2'] = '#1e9e6b';
		}

		$background_settings = ! empty( $this->previous_theme_content['zerif_background_settings'] ) ? $this->previous_theme_content['zerif_background_settings'] : '';

		if ( ! empty( $background_settings ) && $background_settings === 'zerif-background-slider' ) {
			$settings = array();
			for ( $i = 1; $i <= 3; $i++ ) {
				if ( array_key_exists( 'zerif_bgslider_' . $i, $this->previous_theme_content ) ) {
					$bg = $this->previous_theme_content[ 'zerif_bgslider_' . $i ];
					if ( ! empty( $bg ) ) {
						$slide              = $main_slide;
						$slide['image_url'] = esc_url( $bg );
						array_push( $settings, $slide );
					}
				}
				set_theme_mod( 'hestia_slider_type', 'image' );
			}
			$section_is_empty = empty( $main_slide['title'] ) && empty( $main_slide['text'] ) && empty( $main_slide['text2'] ) && empty( $background_settings );
			if ( ! $section_is_empty ) {
				set_theme_mod( 'hestia_slider_content', json_encode( $settings ) );
			}
		} elseif ( $background_settings !== 'zerif-background-video' ) {
			if ( ! empty( $this->previous_theme_content['background_image'] ) ) {
				$main_slide['image_url'] = esc_url( $this->previous_theme_content['background_image'] );
			}
			$section_is_empty = empty( $main_slide['title'] ) && empty( $main_slide['text'] ) && empty( $main_slide['text2'] ) && empty( $main_slide['image_url'] );
			if ( ! $section_is_empty ) {
				set_theme_mod( 'hestia_slider_content', '[' . json_encode( $main_slide ) . ']' );
			}

			if ( ! array_key_exists( 'zerif_parallax_show', $this->previous_theme_content ) ) {
				return;
			}
			$zerif_parallax_use = $this->previous_theme_content['zerif_parallax_show'];
			if ( ! empty( $zerif_parallax_use ) && ( $zerif_parallax_use == 1 ) ) {
				set_theme_mod( 'hestia_slider_type', 'parallax' );
			} else {
				set_theme_mod( 'hestia_slider_type', 'image' );
			}
		}
	}

	/**
	 * Function to import About section.
	 *
	 * @since 1.1.51
	 * @access private
	 */
	private function import_zerif_about() {
		$execute = get_option( 'should_import_zerif_about' );
		if ( $execute !== false ) {
			return;
		}

		$css_to_add    = '';
		$about_content = get_theme_mod( 'hestia_page_editor', '' );

		/* Title and subtitle */
		$title    = array_key_exists( 'zerif_aboutus_title', $this->previous_theme_content ) && ! empty( $this->previous_theme_content['zerif_aboutus_title'] ) ? $this->previous_theme_content['zerif_aboutus_title'] : '';
		$subtitle = array_key_exists( 'zerif_aboutus_subtitle', $this->previous_theme_content ) && ! empty( $this->previous_theme_content['zerif_aboutus_subtitle'] ) ? $this->previous_theme_content['zerif_aboutus_subtitle'] : '';
		if ( ! empty( $title ) || ! empty( $subtitle ) ) {
			$about_content .= '<div class="row"><div class="col-md-8 col-md-offset-2 text-center">';
			if ( ! empty( $title ) ) {
				$about_content .= '<h2 class="hestia-title">' . wp_kses_post( $title ) . '</h2>';
			}
			if ( ! empty( $subtitle ) ) {
				$about_content .= '<h5 class="description">' . wp_kses_post( $subtitle ) . '</h5>';
			}
			$about_content .= '</div></div>';
		}

		/* Left content */
		$left_content = array_key_exists( 'zerif_aboutus_biglefttitle', $this->previous_theme_content ) && ! empty( $this->previous_theme_content['zerif_aboutus_biglefttitle'] ) ? $this->previous_theme_content['zerif_aboutus_biglefttitle'] : '';

		/* Center content */
		$center_content = array_key_exists( 'zerif_aboutus_text', $this->previous_theme_content ) && ! empty( $this->previous_theme_content['zerif_aboutus_text'] ) ? $this->previous_theme_content['zerif_aboutus_text'] : '';

		/* Right content */
		$right_content = '';
		for ( $i = 1; $i <= 4; $i++ ) {
			$knob_title      = ! empty( $this->previous_theme_content[ 'zerif_aboutus_feature' . $i . '_title' ] ) ? $this->previous_theme_content[ 'zerif_aboutus_feature' . $i . '_title' ] : '';
			$knob_text       = ! empty( $this->previous_theme_content[ 'zerif_aboutus_feature' . $i . '_text' ] ) ? $this->previous_theme_content[ 'zerif_aboutus_feature' . $i . '_text' ] : '';
			$knob_percentage = ! empty( $this->previous_theme_content[ 'zerif_aboutus_feature' . $i . '_nr' ] ) ? $this->previous_theme_content[ 'zerif_aboutus_feature' . $i . '_nr' ] : '';
			$knob_color      = ! empty( $this->previous_theme_content[ 'zerif_aboutus_feature' . $i . '_color' ] ) ? $this->previous_theme_content[ 'zerif_aboutus_feature' . $i . '_color' ] : '';
			if ( ! empty( $knob_percentage ) ) {
				if ( $knob_percentage <= 50 ) {
					$rotation    = (int) $knob_percentage * 3.6;
					$css_to_add .= '.progress' . $i . ' .progress-right .progress-bar { margin-right: 10px;border-color: ' . $knob_color . ';-webkit-transform: rotate(' . $rotation . 'deg); transform: rotate(' . $rotation . 'deg);}';
					$css_to_add .= '.progress' . $i . ' .progress-left .progress-bar { margin-right: 10px;border-color: ' . $knob_color . ';-webkit-transform: rotate(0deg); transform: rotate(0deg); }';
				} else {
					$rotation    = ( (int) $knob_percentage - 50 ) * 3.6;
					$css_to_add .= '.progress' . $i . ' .progress-left .progress-bar { margin-right: 10px;border-color: ' . $knob_color . ';-webkit-transform: rotate(' . $rotation . 'deg); transform: rotate(' . $rotation . 'deg);}';
					$css_to_add .= '.progress' . $i . ' .progress-right .progress-bar { margin-right: 10px;border-color: ' . $knob_color . ';-webkit-transform: rotate(180deg); transform: rotate(180deg);}';
				}
				$right_content .= '
					<div class="row">
						<div class="progress progress' . esc_attr( $i ) . '">
		                <span class="progress-left">
		                    <span class="progress-bar"></span>
		                </span>
						<span class="progress-right">
		                    <span class="progress-bar"></span>
		                </span>
						<div class="progress-value">' . wp_kses_post( $knob_percentage ) . '%</div>
						</div>
						<h6 class="category">' . wp_kses_post( $knob_title ) . '</h6>
						<p>' . wp_kses_post( $knob_text ) . '</p>
					</div>';
			}
		}

		/* About section in zerif have 3 columns. If one column is empty, divide the section in two*/
		$content          = array( $left_content, $center_content, $right_content );
		$not_empty_colums = count( array_filter( $content ) );
		if ( ! function_exists( 'wp_update_custom_css_post' ) ) {
			$not_empty_colums--;
		}
		if ( $not_empty_colums <= 0 ) {
			return;
		}

		/* Get bootstrap class name for columns */
		$nb    = 12 / $not_empty_colums;
		$class = 'col-md-' . $nb;

		/* Add section content */
		$about_content .= '<div class="row">';
		if ( ! empty( $left_content ) ) {
			$about_content .= '<div class="' . esc_attr( $class ) . ' text-right">';
			$about_content .= '<h3>' . wp_kses_post( $left_content ) . '</h3>';
			$about_content .= '</div>';
		}
		if ( ! empty( $center_content ) ) {
			$about_content .= '<div class="' . esc_attr( $class ) . '">';
			$about_content .= '<p>' . wp_kses_post( $center_content ) . '</p>';
			$about_content .= '</div>';
		}
		if ( ! empty( $right_content ) && function_exists( 'wp_update_custom_css_post' ) ) {
			/* This is the css for knobs */
			$css_to_add .= '
			.progress{
				width: 70px;
				height: 70px;
				line-height: 70px;
				margin: 0 auto;
				position: relative;
				display: inline-block;
				float: left;
				margin-right: 15px;
				margin-top: 15px;
			}
			.progress > span{
				width: 50%;
				height: 100%;
				overflow: hidden;
				position: absolute;
				top: 0;
				z-index: 1;
			}
			.progress .progress-left{
				left: 0;
			}
			.progress .progress-bar{
				width: 100%;
				height: 100%;
				background: none;
				border-width: 8px;
				border-style: solid;
				position: absolute;
				top: 0;
			}
			.progress .progress-left .progress-bar{
				left: 100%;
				border-top-right-radius: 80px;
				border-bottom-right-radius: 80px;
				border-left: 0;
				-webkit-transform-origin: center left;
				transform-origin: center left;
			}
			.progress .progress-right{
				right: 0;
			}
			.progress .progress-right .progress-bar{
				left: -100%;
				border-top-left-radius: 80px;
				border-bottom-left-radius: 80px;
				border-right: 0;
				-webkit-transform-origin: center right;
				transform-origin: center right;
			}
			.progress .progress-value{
				width: 54px;
				height: 54px;
				border-radius: 50%;
				background: #44484b;
				font-size: 13px;
				color: #fff;
				line-height: 54px;
				text-align: center;
				position: absolute;
				top: 8px;
				left: 8px;
			}
			.progress.blue .progress-bar{
				border-color: #049dff;
			}';
			wp_update_custom_css_post( $css_to_add );
			$about_content .= '<div class="' . esc_attr( $class ) . '">';
			$about_content .= wp_kses_post( $right_content );
			$about_content .= '</div>';
		}
		$about_content .= '</div>';

		if ( ! empty( $about_content ) ) {
			set_theme_mod( 'hestia_page_editor', $about_content );
			$this->sync_content_from_control( $about_content );
		}

		update_option( 'should_import_zerif_about', true );
	}

	/**
	 * Function to import Packages section.
	 * Because in hestia are only two tables, we only import two widgets from packages in this section.
	 *
	 * @since 1.1.51
	 * @access private
	 */
	private function import_zerif_packages() {

		if ( ! isset( $this->previous_theme_content['zerif_packages_show'] ) ) {
			$display_packages = false;
		} else {
			$display_packages = get_theme_mod( $this->previous_theme_content['zerif_packages_show'] );
		}

		$hestia_pricing_hide = get_theme_mod( 'hestia_pricing_hide' );
		if ( ( ! empty( $display_packages ) && $display_packages === false ) || $hestia_pricing_hide === true ) {
			return;
		}

		$sidebars = get_option( 'sidebars_widgets' );
		if ( ! array_key_exists( 'sidebar-packages', $sidebars ) ) {
			return;
		}

		set_theme_mod( 'hestia_pricing_hide', false );

		/* Get two widgets ids from this section */
		$widget_ids = $sidebars['sidebar-packages'];
		if ( empty( $widget_ids ) ) {
			return;
		}
		$ids_to_grab = array();
		$items       = 2;
		foreach ( $widget_ids as $widget_id ) {
			if ( strpos( $widget_id, 'color-picker' ) !== false && $items > 0 ) {
				$short_id_transient = explode( '-', $widget_id );
				$short_id           = end( $short_id_transient );
				array_push( $ids_to_grab, $short_id );
				$items--;
			}
		}

		/* Get all widgets from packages section and import just the ones that have one of those ids that we've selected earlier */
		$all_widgets = get_option( 'widget_color-picker' );

		if ( ! empty( $ids_to_grab[0] ) && array_key_exists( $ids_to_grab[0], $all_widgets ) ) {
			$current_widget = $all_widgets[ $ids_to_grab[0] ];
			$this->import_package( $current_widget, 'one' );
		}

		if ( ! empty( $ids_to_grab[1] ) && array_key_exists( $ids_to_grab[1], $all_widgets ) ) {
			$current_widget = $all_widgets[ $ids_to_grab[1] ];
			$this->import_package( $current_widget, 'two' );
		}
	}

	/**
	 * Update theme mods from hestia based on content from zerif package widget.
	 *
	 * @param array  $content Content from zerif's widget.
	 * @param string $table Destination table for the widget.
	 * @since 1.1.51
	 * @access private
	 */
	private function import_package( $content, $table ) {

		if ( ! in_array( $table, array( 'one', 'two' ) ) || empty( $content ) ) {
			return;
		}

		$pricing_table_title    = get_theme_mod( 'hestia_pricing_table_' . $table . '_title' );
		$pricing_table_price    = get_theme_mod( 'hestia_pricing_table_' . $table . '_price' );
		$pricing_table_features = get_theme_mod( 'hestia_pricing_table_' . $table . '_features' );
		$pricing_table_link     = get_theme_mod( 'hestia_pricing_table_' . $table . '_link' );
		$pricing_table_text     = get_theme_mod( 'hestia_pricing_table_' . $table . '_text' );
		$table_is_empty         = empty( $pricing_table_title ) && empty( $pricing_table_price ) && empty( $pricing_table_features ) && empty( $pricing_table_link ) && empty( $pricing_table_text ) && empty( $table_is_empty );

		if ( ! $table_is_empty ) {
			return;
		}

		if ( ! empty( $content['title'] ) ) {
			set_theme_mod( 'hestia_pricing_table_' . $table . '_title', $content['title'] );
		}

		$price = '';
		if ( ! empty( $content['price'] ) ) {
			if ( ! empty( $content['currency'] ) ) {
				$price .= '<small>' . $content['currency'] . '</small>';
			}
			$price .= $content['price'];
			if ( ! empty( $content['price_meta'] ) ) {
				$price .= '<small>' . $content['price_meta'] . '</small>';
			}
		}
		if ( ! empty( $price ) ) {
			set_theme_mod( 'hestia_pricing_table_' . $table . '_price', $price );
		}

		if ( ! empty( $content['button_link'] ) ) {
			set_theme_mod( 'hestia_pricing_table_' . $table . '_link', $content['button_link'] );
		}

		if ( ! empty( $content['button_label'] ) ) {
			set_theme_mod( 'hestia_pricing_table_' . $table . '_text', $content['button_label'] );
		}

		/**
		 * Zerif's package widget have 10 possible items in a package. If an item isn't empty we need to concatenate
		 * it and to add \n character to tell the control in hestia that it's a new item.
		 */
		$features = '';
		for ( $i = 1; $i <= 10; $i++ ) {
			if ( ! empty( $content[ 'item' . $i ] ) ) {
				$features .= $content[ 'item' . $i ] . '\n';
			}
		}
		if ( ! empty( $features ) ) {
			set_theme_mod( 'hestia_pricing_table_' . $table . '_features', $features );
		}
	}

	/**
	 * Transfer widgets from Our focus, Testimonials, Team and About us to theme mods in hestia
	 *
	 * @since 1.1.51
	 * @access private
	 */
	private function widgets_to_theme_mods() {

		$sidebars = array(
			'hestia_features_content'     => array( 'sidebar-ourfocus', 'ctup-ads' ),
			'hestia_testimonials_content' => array( 'sidebar-testimonials', 'zerif_testim' ),
			'hestia_clients_bar_content'  => array( 'sidebar-aboutus', 'zerif_clients' ),
			'hestia_team_content'         => array( 'sidebar-ourteam', 'zerif_team' ),
		);

		foreach ( $sidebars as $hestia_corespondent => $sidebar_settings ) {
			$hestia_content         = get_theme_mod( $hestia_corespondent );
			$hestia_content_decoded = json_decode( $hestia_content );
			if ( empty( $hestia_content_decoded ) ) {
				$content = $this->get_sidebar_content( $sidebar_settings[0], $sidebar_settings[1] );
				if ( ! empty( $content ) ) {
					set_theme_mod( $hestia_corespondent, $content );
				}
			}
		}
	}

	/**
	 * Returns the content from Our focus, Testimonials, Team and About in json format
	 *
	 * @param string $sidebar Sidebar name.
	 * @param string $prefix Prefix of widgets in that sidebar.
	 *
	 * @since 1.1.51
	 * @access private
	 * @return array|string
	 */
	private function get_sidebar_content( $sidebar, $prefix ) {
		$sidebars              = get_option( 'sidebars_widgets' );
		$data_in_hestia_format = array();
		if ( array_key_exists( $sidebar, $sidebars ) ) {
			$widget_ids = $sidebars[ $sidebar ];
			if ( empty( $widget_ids ) ) {
				return '';
			}
			$ids_to_grab = array();
			foreach ( $widget_ids as $widget_id ) {
				if ( strpos( $widget_id, $prefix ) !== false ) {
					$short_id_transient = explode( '-', $widget_id );
					$short_id           = end( $short_id_transient );
					array_push( $ids_to_grab, $short_id );
				}
			}
			$all_widgets = get_option( 'widget_' . $prefix . '-widget' );
			foreach ( $ids_to_grab as $key ) {
				$widget_data = array();
				if ( array_key_exists( $key, $all_widgets ) ) {
					$current_widget = $all_widgets[ $key ];
					if ( ! empty( $current_widget ) ) {
						$social_repeater = array();
						foreach ( $current_widget as $key => $value ) {
							$repeater_key = $this->get_key( $key );
							if ( ! empty( $value ) && ! empty( $repeater_key ) ) {
								if ( $repeater_key === 'social_repeater' ) {
									$social = $this->get_repeater_social( $key, $value );
									array_push( $social_repeater, $social );
								} else {
									$widget_data[ $repeater_key ] = $value;
								}
							}
						}
						$widget_data['social_repeater'] = json_encode( $social_repeater );
						$widget_data['choice']          = 'customizer_repeater_image';
					}
				}
				if ( ! empty( $widget_data ) ) {
					array_push( $data_in_hestia_format, $widget_data );
				}
			}
		}
		return json_encode( $data_in_hestia_format );
	}

	/**
	 * Return content to add to social repeater. Used for team members.
	 *
	 * @param string $social_name Name of social link.
	 * @param string $value Link of social.
	 *
	 * @since 1.1.51
	 * @access private
	 * @return array
	 */
	private function get_repeater_social( $social_name, $value ) {
		$result = array(
			'icon' => '',
			'link' => $value,
		);
		switch ( $social_name ) {
			case 'fb_link':
				$result['icon'] = 'fa-facebook';
				break;
			case 'tw_link':
				$result['icon'] = 'fa-twitter';
				break;
			case 'bh_link':
				$result['icon'] = 'fa-behance';
				break;
			case 'db_link':
				$result['icon'] = 'fa-dribbble';
				break;
			case 'ln_link':
				$result['icon'] = 'fa-linkedin';
				break;
			case 'gp_link':
				$result['icon'] = 'fa-google-plus';
				break;
			case 'pinterest_link':
				$result['icon'] = 'fa-pinterest-p';
				break;
			case 'tumblr_link':
				$result['icon'] = 'fa-tumblr';
				break;
			case 'reddit_link':
				$result['icon'] = 'fa-reddit-alien';
				break;
			case 'youtube_link':
				$result['icon'] = 'fa-youtube';
				break;
			case 'instagram_link':
				$result['icon'] = 'fa-instagram';
				break;
			case 'website_link':
				$result['icon'] = 'fa-globe';
				break;
			case 'email_link':
				$result['icon'] = 'fa-envelope';
				break;
			case 'phone_link':
				$result['icon'] = 'fa-phone';
				break;
			case 'profile_link':
				$result['icon'] = 'fa-user';
				break;
		}
		return $result;
	}

	/**
	 * Map widgets inputs names to repeater inputs
	 *
	 * @param string $key Name of the inputs.
	 *
	 * @since 1.1.51
	 * @access private
	 * @return bool|string
	 */
	private function get_key( $key ) {
		$repeater_map = array(
			'image_url'       => array( 'image_url', 'image_uri' ),
			'title'           => array( 'title', 'name' ),
			'subtitle'        => array( 'subtitle', 'position', 'details' ),
			'text'            => array( 'text', 'description' ),
			'link'            => array( 'link' ),
			'social_repeater' => array( 'fb_link', 'tw_link', 'bh_link', 'db_link', 'ln_link', 'gp_link', 'pinterest_link', 'tumblr_link', 'reddit_link', 'youtube_link', 'instagram_link', 'website_link', 'email_link', 'phone_link', 'profile_link' ),
		);
		foreach ( $repeater_map as $k => $v ) {
			if ( in_array( $key, $v ) ) {
				return $k;
			}
		}
		return false;
	}

	/**
	 * Sets all the simple theme mods provided in the parameter array.
	 *
	 * @access private
	 * @since 1.1.51
	 */
	private function set_simple_mods() {
		$mods = $this->match_controls;
		// Prefix the theme mods with the previous active theme name and set them in Hestia.
		if ( ! empty( $mods ) ) {
			foreach ( $mods as $hestia_mod => $imported_mod ) {
				$this->set_hestia_mod( $hestia_mod, $imported_mod );
			}
		}
	}

	/**
	 * Utility method to set theme mod from import.
	 *
	 * @param hestia-mod-id   $hestia_mod_id the hestia mod to set.
	 * @param imported-mod-id $imported_mod_id the imported theme mod id.
	 *
	 * @access private
	 * @since 1.1.51
	 */
	private final function set_hestia_mod( $hestia_mod_id, $imported_mod_id ) {
		$hestia_mod = get_theme_mod( $hestia_mod_id );
		if ( array_key_exists( $imported_mod_id, $this->previous_theme_content ) ) {
			$imported_mod = $this->previous_theme_content[ $imported_mod_id ];
			if ( ! empty( $imported_mod ) && empty( $hestia_mod ) ) {
				set_theme_mod( $hestia_mod_id, $imported_mod );
			}
		}
	}

	/**
	 * Import Bottom Button ribbon to Hestia's about section.
	 *
	 * @access private
	 * @since 1.1.51
	 */
	private function import_zerif_bottom_button_ribbon() {

		$execute = get_option( 'should_import_zerif_ribbon' );
		if ( $execute !== false ) {
			return;
		}

		$title        = ! empty( $this->previous_theme_content['zerif_bottomribbon_text'] ) ? $this->previous_theme_content['zerif_bottomribbon_text'] : '';
		$button_label = ! empty( $this->previous_theme_content['zerif_bottomribbon_buttonlabel'] ) ? $this->previous_theme_content['zerif_bottomribbon_buttonlabel'] : '';
		$button_link  = ! empty( $this->previous_theme_content['zerif_bottomribbon_buttonlink'] ) ? $this->previous_theme_content['zerif_bottomribbon_buttonlink'] : '';
		if ( empty( $title ) && empty( $button_label ) ) {
			return;
		}

		$section_content = '<div class="row"><div class="col-md-12 text-center">';
		if ( ! empty( $title ) ) {
			$section_content .= '<h2 class="hestia-title">' . wp_kses_post( $title ) . '</h2>';
		}
		if ( ! empty( $button_label ) && ! empty( $button_link ) ) {
			$section_content .= '<a href="' . esc_url( $button_link ) . '" class="btn btn-primary btn-lg">' . wp_kses_post( $button_label ) . '</a>';
		}
		$section_content .= '</div></div>';

		$hestia_about  = get_theme_mod( 'hestia_page_editor' );
		$hestia_about .= $section_content;
		if ( ! empty( $hestia_about ) ) {
			set_theme_mod( 'hestia_page_editor', $hestia_about );
			$this->sync_content_from_control( $hestia_about );
		}

		update_option( 'should_import_zerif_ribbon', true );
	}

	/**
	 * Import content from footer to contact section.
	 *
	 * @access private
	 * @since 1.1.51
	 */
	private function import_zerif_footer() {
		$icon1           = ! empty( $this->previous_theme_content['zerif_email_icon'] ) ? $this->previous_theme_content['zerif_email_icon'] : '';
		$text1           = ! empty( $this->previous_theme_content['zerif_email'] ) ? $this->previous_theme_content['zerif_email'] : '';
		$icon2           = ! empty( $this->previous_theme_content['zerif_phone_icon'] ) ? $this->previous_theme_content['zerif_phone_icon'] : '';
		$text2           = ! empty( $this->previous_theme_content['zerif_phone'] ) ? $this->previous_theme_content['zerif_phone'] : '';
		$icon3           = ! empty( $this->previous_theme_content['zerif_address_icon'] ) ? $this->previous_theme_content['zerif_address_icon'] : '';
		$text3           = ! empty( $this->previous_theme_content['zerif_address'] ) ? $this->previous_theme_content['zerif_address'] : '';
		$section_content = array(
			$icon1 => $text1,
			$icon2 => $text2,
			$icon3 => $text3,
		);
		if ( ! empty( $section_content ) ) {
			$contact_html = '';
			foreach ( $section_content as $icon => $text ) {
				$contact_html .= '<div class="info info-horizontal">';
				if ( ! empty( $icon ) ) {
					$contact_html .= '<div class="icon icon-primary"><img src="' . esc_url( $icon ) . '"></div>';
				}
				if ( ! empty( $text ) ) {
					$contact_html .= '<h4 class="info-title">' . wp_kses_post( $text ) . '</h4>';
				}
				$contact_html .= '</div>';
			}
			$contact_content = get_theme_mod( 'hestia_contact_content_new' );
			if ( empty( $contact_content ) ) {
				set_theme_mod( 'hestia_contact_content_new', $contact_html );
			}
		}
	}

	/**
	 * Import footer socials into hestia footer menu.
	 *
	 * @access private
	 * @since 1.1.51
	 */
	private function import_zerif_footer_socials() {
		$zerif_socials = array(
			'zerif_socials_facebook',
			'zerif_socials_twitter',
			'zerif_socials_linkedin',
			'zerif_socials_behance',
			'zerif_socials_dribbble',
			'zerif_socials_googleplus',
			'zerif_socials_pinterest',
			'zerif_socials_tumblr',
			'zerif_socials_reddit',
			'zerif_socials_youtube',
			'zerif_socials_instagram',
		);

		$theme_navs = get_theme_mod( 'nav_menu_locations' );
		if ( empty( $theme_navs['footer'] ) ) {

			$menu_name   = 'Footer socials menu';
			$menu_exists = wp_get_nav_menu_object( $menu_name );
			if ( ! $menu_exists ) {
				$menu_id = wp_create_nav_menu( $menu_name );

				foreach ( $zerif_socials as $social ) {
					if ( ! empty( $this->previous_theme_content[ $social ] ) ) {
						wp_update_nav_menu_item(
							$menu_id, 0, array(
								'menu-item-title'  => 'Custom Page',
								'menu-item-url'    => $this->previous_theme_content[ $social ],
								'menu-item-status' => 'publish',
							)
						);
					}
				}

				$theme_navs['footer'] = $menu_id;
			}
		}
		set_theme_mod( 'nav_menu_locations', $theme_navs );
	}

	/**
	 * Move widgets from old sidebars to hestia's sidebars
	 *
	 * @access private
	 * @since 1.1.51
	 */
	private function import_sidebars() {
		$widgets_from_old_theme = wp_get_sidebars_widgets();
		$new_widget_array       = array();

		if ( ! empty( $widgets_from_old_theme['sidebar-1'] ) ) {
			$new_widget_array['sidebar-1'] = $widgets_from_old_theme['sidebar-1'];
		}

		if ( ! empty( $widgets_from_old_theme['zerif-sidebar-footer'] ) ) {
			$new_widget_array['footer-one-widgets'] = $widgets_from_old_theme['zerif-sidebar-footer'];
		}

		if ( ! empty( $widgets_from_old_theme['zerif-sidebar-footer-2'] ) ) {
			$new_widget_array['footer-two-widgets'] = $widgets_from_old_theme['zerif-sidebar-footer-2'];
		}

		if ( ! empty( $widgets_from_old_theme['zerif-sidebar-footer-3'] ) ) {
			$new_widget_array['footer-three-widgets'] = $widgets_from_old_theme['zerif-sidebar-footer-3'];
		}
		if ( ! isset( $new_widget_array['wp_inactive_widgets'] ) ) {
			$new_widget_array['wp_inactive_widgets'] = array();
		}

		update_option( 'sidebars_widgets', $new_widget_array );
	}

	/**
	 * Import menus from zerif
	 *
	 * @access private
	 * @since 1.1.51
	 */
	private function import_menus() {
		$theme_navs = get_theme_mod( 'nav_menu_locations' );
		if ( empty( $theme_navs['primary'] ) && ! empty( $nav_locations['primary'] ) ) {
			$theme_navs['primary'] = $nav_locations['primary'];
		}
		set_theme_mod( 'nav_menu_locations', $theme_navs );
	}

	/**
	 * Import sections order in hestia.
	 *
	 * @access private
	 * @since 1.1.51
	 */
	private function import_section_order() {
		$result_order    = array(
			'hestia_features'                   => 10,
			'hestia_ribbon'                     => 15,
			'hestia_portfolio'                  => 20,
			'hestia_about'                      => 25,
			'hestia_clients_bar'                => 30,
			'hestia_team'                       => 35,
			'hestia_testimonials'               => 40,
			'hestia_contact'                    => 45,
			'hestia_pricing'                    => 50,
			'sidebar-widgets-subscribe-widgets' => 55,
			'hestia_shop'                       => 60,
			'hestia_blog'                       => 65,
		);
		$section_mapping = array(
			'our_focus'    => 'hestia_features',
			'portofolio'   => 'hestia_portfolio',
			'about_us'     => 'hestia_about',
			'our_team'     => 'hestia_team',
			'testimonials' => 'hestia_testimonials',
			'right_ribbon' => 'hestia_ribbon',
			'contact_us'   => 'hestia_contact',
			'packages'     => 'hestia_pricing',
			'subscribe'    => 'sidebar-widgets-subscribe-widgets',
			'latest_news'  => 'hestia_blog',
		);
		for ( $i = 1; $i <= 13; $i++ ) {
			if ( ! empty( $this->previous_theme_content[ 'section' . $i ] ) ) {
				if ( array_key_exists( $this->previous_theme_content[ 'section' . $i ], $section_mapping ) ) {
					$hestia_section                  = $section_mapping[ $this->previous_theme_content[ 'section' . $i ] ];
					$result_order[ $hestia_section ] = ( $i * 5 ) + 5;
				}
			}
		}

		if ( empty( $sections_order ) ) {
			set_theme_mod( 'sections_order', json_encode( $result_order ) );
		}
	}

}