/**
  * 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']);
 }
Ejemplo n.º 2
0
/**
 * 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));
}
Ejemplo n.º 3
0
    /**
     * Helper that ouput header image choices.
     */
    private function header_image_list()
    {
        $cat = wpem_get_site_industry();
        $images = $this->image_api->get_images_by_cat($cat);
        if (empty($images)) {
            return;
        }
        shuffle($images);
        // Limit the number of images displayed
        $images = array_slice($images, 0, absint(static::MAX_HEADER_IMAGES));
        ?>
		<ul class="wpem-header-images-list">
			<?php 
        foreach ($images as $key => $image) {
            ?>
			<li <?php 
            echo 0 === $key ? 'class="selected"' : '';
            ?>
>
				<a href="#" data-image-url="<?php 
            echo esc_url($image->large);
            ?>
">
					<span class="screen-reader-text"><?php 
            _e('Set image');
            ?>
 </span>
					<img src="<?php 
            echo esc_url($image->preview);
            ?>
">
				</a>
			</li>
			<?php 
        }
        ?>
		</ul>
		<p class="description"><?php 
        _e('You can change this header image again later, or even upload a custom image from your computer.', 'wp-easy-mode');
        ?>
</p>
		<?php 
    }
Ejemplo n.º 4
0
 /**
  * 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));
 }