/**
  * Step init
  */
 protected function init()
 {
     $fields = [['name' => 'wpem_site_type', 'label' => __('Type', 'wp-easy-mode'), 'type' => 'radio', 'sanitizer' => 'sanitize_key', 'description' => __('What type of website would you like to create?', 'wp-easy-mode'), 'value' => wpem_get_site_type(), 'required' => true, 'choices' => ['standard' => __('Website + Blog', 'wp-easy-mode'), 'blog' => __('Blog only', 'wp-easy-mode'), 'store' => __('Online Store', 'wp-easy-mode')]], ['name' => 'wpem_site_industry', 'label' => __('Industry', 'wp-easy-mode'), 'type' => 'select', 'sanitizer' => 'sanitize_key', 'description' => __('What will your website be about?', 'wp-easy-mode'), 'value' => wpem_get_site_industry(), 'required' => true, 'choices' => wpem_get_site_industry_slugs_to('label')], ['name' => 'blogname', 'label' => __('Title', 'wp-easy-mode'), 'type' => 'text', 'sanitizer' => function ($value) {
         return stripcslashes(sanitize_option('blogname', $value));
     }, 'description' => __('The title of your website appears at the top of all pages and in search results.', 'wp-easy-mode'), 'value' => get_option('blogname'), 'required' => true, 'atts' => ['placeholder' => __('Enter your website title here', 'wp-easy-mode')]], ['name' => 'blogdescription', 'label' => __('Tagline', 'wp-easy-mode'), 'type' => 'text', 'sanitizer' => function ($value) {
         return stripcslashes(sanitize_option('blogdescription', $value));
     }, 'description' => __('Think of the tagline as a slogan that describes what makes your website special. It will also appear in search results.', 'wp-easy-mode'), 'value' => get_option('blogdescription'), 'required' => true, 'atts' => ['placeholder' => __('Enter your website tagline here', 'wp-easy-mode')]]];
     $this->fields = new Fields($fields);
     add_action('wpem_template_notices', [$this->fields, 'error_notice']);
 }
/**
 * Display the template body class
 */
function wpem_template_body_class()
{
    $classes = ['wp-core-ui', 'wpem-screen', sprintf('wpem-step-%d', wpem_get_current_step()->position), sprintf('wpem-step-%s', wpem_get_current_step()->name), sprintf('wpem-type-%s', wpem_get_site_type()), sprintf('wpem-industry-%s', wpem_get_site_industry())];
    /**
     * Filter the template body class
     *
     * @since 2.0.0
     *
     * @var array
     */
    $classes = (array) apply_filters('wpem_template_body_class', $classes);
    echo implode(' ', array_map('esc_attr', $classes));
}
 /**
  * Class constructor
  */
 public function __construct()
 {
     $this->site_type = wpem_get_site_type();
     $this->permalinks();
     $this->menus();
     $this->pages();
     add_action('wpem_page_created', array($this, 'assign_woocommerce_pages'), 10, 2);
     $this->widgets();
     $this->user_meta();
     $this->ninja_forms();
     $this->woocommerce();
     $this->redirect();
 }
 /**
  * Register admin menu and assets
  *
  * @action admin_menu
  */
 public function menu()
 {
     add_dashboard_page(_x('WP Easy Mode', 'Main plugin title', 'wp-easy-mode'), _x('Easy Mode', 'Menu title', 'wp-easy-mode'), $this->cap, static::SLUG, array($this, 'screen'));
     wp_register_style('wpem-fullscreen', WPEM_URL . 'assets/css/fullscreen.css', array('dashicons', 'buttons', 'install'), WPEM_VERSION);
     wp_register_script('jquery-blockui', WPEM_URL . 'assets/js/jquery.blockui.min.js', array('jquery'), '2.70.0');
     wp_register_script('wpem', WPEM_URL . 'assets/js/common.js', array('jquery'), WPEM_VERSION);
     wp_register_script('wpem-theme', WPEM_URL . 'assets/js/theme.js', array('wpem'), WPEM_VERSION);
     wp_localize_script('wpem', 'wpem_vars', array('step' => wpem_get_current_step()->name, 'i18n' => array('exit_confirm' => esc_attr__('Are you sure you want to exit and configure WordPress on your own?', 'wp-easy-mode'))));
     /**
      * Filter the list of themes to display
      *
      * 1. The 'theme' step must be registered.
      * 2. Only themes available on WordPress.org are supported.
      * 3. If a user selects a theme that is not yet installed
      *    it will be downloaded and activated automatically.
      *
      * @param string $site_type
      *
      * @var   array
      */
     $themes = (array) apply_filters('wpem_themes', array('twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentytwelve', 'twentyeleven'), wpem_get_site_type());
     wp_localize_script('wpem-theme', 'wpem_theme_vars', array('themes' => array_map('esc_js', array_values(array_unique($themes))), 'i18n' => array('expand' => esc_attr__('Expand Sidebar', 'wp-easy-mode'), 'collapse' => esc_attr__('Collapse Sidebar', 'wp-easy-mode'))));
 }
    /**
     * Step content
     */
    public function content()
    {
        ?>
		<style type="text/css">
			.wp-full-overlay.expanded {
				margin-left: 275px;
			}
			.wp-full-overlay.expanded .wp-full-overlay-sidebar {
				width: 275px;
			}
			.wp-full-overlay.expanded .wp-full-overlay-footer {
				width: auto;
			}
			.install-theme-info .theme-details {
				margin-top: 10px;
			}
		</style>

		<p class="lead-text align-center"><?php 
        _e("Choose a design for your website (don't worry, you can change this later)", 'wp-easy-mode');
        ?>
</p>

		<div class="theme-browser rendered">

			<div class="themes"></div>

		</div>

		<script type="text/html" id="wpem-template-theme">
			<div class="theme">
				<div class="theme-screenshot"><img src="#"></div>
				<span class="more-details"><?php 
        _e('Preview', 'wp-easy-mode');
        ?>
</span>
				<div class="theme-author"><?php 
        _e('By', 'wp-easy-mode');
        ?>
 <span></span></div>
				<h3 class="theme-name"></h3>
				<a href="#" class="preview-theme"></a>
			</div>
		</script>

		<script type="text/html" id="wpem-template-theme-preview">
			<div class="theme-install-overlay wp-full-overlay expanded">
				<div class="wp-full-overlay-sidebar">
					<div class="wp-full-overlay-header">
						<a href="#" class="close-full-overlay"><span class="screen-reader-text"><?php 
        _e('Close', 'wp-easy-mode');
        ?>
</span></a>
						<a href="#" class="previous-theme"><span class="screen-reader-text"><?php 
        _e('Previous', 'wp-easy-mode');
        ?>
</span></a>
						<a href="#" class="next-theme"><span class="screen-reader-text"><?php 
        _e('Next', 'wp-easy-mode');
        ?>
</span></a>
						<a href="#" class="button button-primary theme-install"><?php 
        _e('Select', 'wp-easy-mode');
        ?>
</a>
					</div>
					<div class="wp-full-overlay-sidebar-content">
						<div class="install-theme-info">
							<h3 class="theme-name"></h3>
							<span class="theme-by"><?php 
        _e('By', 'wp-easy-mode');
        ?>
 <span></span></span>
							<div class="theme-details">
								<div class="theme-description"></div>
							</div>
							<div id="wpem-header-images-wrapper"></div>
						</div>
					</div>
					<div class="wp-full-overlay-footer">
						<button type="button" class="collapse-sidebar button-secondary expanded" aria-expanded="true" aria-label="<?php 
        esc_attr_e('Collapse Sidebar', 'wp-easy-mode');
        ?>
">
							<span class="collapse-sidebar-arrow"></span>
							<span class="collapse-sidebar-label"><?php 
        _e('Collapse', 'wp-easy-mode');
        ?>
</span>
						</button>
					</div>
				</div>
				<div class="wp-full-overlay-main"></div>
			</div>
		</script>

		<?php 
        if ('store' !== wpem_get_site_type()) {
            ?>
			<script type="text/html" id="wpem-template-header-images">
				<h4><?php 
            _e('Suggested Header Images', 'wp-easy-mode');
            ?>
</h4>
				<?php 
            $this->header_image_list();
            ?>
			</script>
		<?php 
        }
    }
 /**
  * Return a URL for the demo API
  *
  * @param  array $args (optional)
  * @param  bool  $hide_empty_args (optional)
  *
  * @return string
  */
 public static function demo_site_url($args = [], $hide_empty_args = true)
 {
     $defaults = ['site_type' => wpem_get_site_type(), 'site_industry' => wpem_get_site_industry(), 'lang' => get_locale()];
     $args = array_merge($defaults, $args);
     $args = $hide_empty_args ? array_filter($args) : $args;
     return add_query_arg(array_map('urlencode', $args), esc_url_raw(wpem()->api_url));
 }
 /**
  * Step callback
  */
 public function callback()
 {
     $options = array(array('name' => 'wpem_site_type', 'label' => __('Type', 'wp-easy-mode'), 'sanitizer' => 'sanitize_key', 'required' => true), array('name' => 'wpem_site_industry', 'label' => __('Industry', 'wp-easy-mode'), 'sanitizer' => 'sanitize_key', 'required' => true), array('name' => 'blogname', 'label' => __('Title', 'wp-easy-mode'), 'sanitizer' => 'sanitize_text_field', 'required' => true), array('name' => 'blogdescription', 'label' => __('Tagline', 'wp-easy-mode'), 'sanitizer' => 'sanitize_text_field', 'required' => true));
     /**
      * Filter the options to be saved
      *
      * @var array
      */
     $options = (array) apply_filters('wpem_step_settings_options', $options);
     $this->bulk_update_options($options);
     $this->install_ninja_forms();
     if ('store' === wpem_get_site_type()) {
         $this->install_woocommerce();
     }
 }