/**
  * Step init
  */
 protected function init()
 {
     $fields = [['name' => 'wpem_contact_info[email]', 'id' => 'wpem_contact_email', 'label' => __('Email', 'wp-easy-mode'), 'type' => 'email', 'sanitizer' => 'sanitize_email', 'description' => __('An email address where website vistors can contact you.', 'wp-easy-mode'), 'value' => wpem_get_contact_info('email', wp_get_current_user()->user_email), 'default' => '', 'atts' => ['placeholder' => __('Enter your email address here', 'wp-easy-mode')]], ['name' => 'wpem_contact_info[phone]', 'id' => 'wpem_contact_phone', 'label' => __('Phone Number', 'wp-easy-mode'), 'type' => 'text', 'sanitizer' => 'wpem_sanitize_phone', 'description' => __('A phone number that website vistors can call if they have questions.', 'wp-easy-mode'), 'value' => wpem_get_contact_info('phone'), 'default' => '', 'atts' => ['placeholder' => __('Enter your phone number here', 'wp-easy-mode')]], ['name' => 'wpem_contact_info[fax]', 'id' => 'wpem_contact_fax', 'label' => __('Fax Number', 'wp-easy-mode'), 'type' => 'text', 'sanitizer' => 'wpem_sanitize_phone', 'description' => __('A fax number that website vistors can use to send important documents.', 'wp-easy-mode'), 'value' => wpem_get_contact_info('fax'), 'default' => '', 'atts' => ['placeholder' => __('Enter your fax number here', 'wp-easy-mode')]], ['name' => 'wpem_contact_info[address]', 'id' => 'wpem_contact_address', 'label' => __('Address', 'wp-easy-mode'), 'sanitizer' => function ($value) {
         return nl2br(wp_kses_post($value));
     }, 'type' => 'textarea', 'description' => __('A physical address where website vistors can go to visit you in person.', 'wp-easy-mode'), 'value' => wpem_get_contact_info('address'), 'default' => '', 'atts' => ['placeholder' => __('Enter your street address here', 'wp-easy-mode')]], ['name' => 'wpem_social_profiles', 'sanitizer' => 'sanitize_text_field', 'default' => [], 'skip_log' => true]];
     $this->fields = new Fields($fields);
 }
Пример #2
0
 /**
  * WooCommerce
  */
 private function woocommerce()
 {
     // Force secure checkout when SSL is already present
     if (is_ssl()) {
         update_option('woocommerce_force_ssl_checkout', 'yes');
     }
     $email = wpem_get_contact_info('email');
     $email = empty($email) ? wp_get_current_user()->user_email : $email;
     update_option('woocommerce_email_from_address', $email);
     update_option('woocommerce_stock_email_recipient', $email);
     $country = !empty($this->log->geodata['country_code']) ? $this->log->geodata['country_code'] : null;
     $region = !empty($this->log->geodata['region_code']) ? $this->log->geodata['region_code'] : null;
     if ($country) {
         $this->woocommerce_locale_settings($country, $region);
     }
 }
Пример #3
0
 /**
  * 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, wpem()->page_slug, [$this, 'screen']);
     $suffix = SCRIPT_DEBUG ? '' : '.min';
     wp_register_style('font-awesome', wpem()->assets_url . 'css/font-awesome.min.css', [], '4.5.0');
     wp_register_style('wpem-fullscreen', wpem()->assets_url . "css/fullscreen{$suffix}.css", ['dashicons', 'buttons', 'install'], wpem()->version);
     wp_register_script('jquery-blockui', wpem()->assets_url . 'js/jquery.blockui.min.js', ['jquery'], '2.70.0');
     wp_register_script('wpem', wpem()->assets_url . "js/common{$suffix}.js", ['jquery'], wpem()->version);
     wp_register_script('wpem-contact', wpem()->assets_url . "js/contact{$suffix}.js", ['wpem'], wpem()->version);
     wp_register_script('wpem-theme', wpem()->assets_url . "js/theme{$suffix}.js", ['wpem', 'wp-pointer', 'wpem-pointers'], wpem()->version);
     wp_localize_script('wpem', 'wpem_vars', ['step' => wpem_get_current_step()->name, 'i18n' => ['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
      *
      * @var array
      */
     $themes = (array) apply_filters('wpem_themes', ['twentysixteen', 'twentyfifteen', 'twentyfourteen']);
     wp_localize_script('wpem-theme', 'wpem_theme_vars', ['themes' => array_map('esc_js', array_values(array_unique($themes))), 'i18n' => ['expand' => esc_attr__('Expand Sidebar', 'wp-easy-mode'), 'collapse' => esc_attr__('Collapse Sidebar', 'wp-easy-mode')], 'preview_url' => static::demo_site_url(['blogname' => get_option('blogname'), 'blogdescription' => get_option('blogdescription'), 'email' => wpem_get_contact_info('email'), 'phone' => wpem_get_contact_info('phone'), 'fax' => wpem_get_contact_info('fax'), 'address' => wpem_get_contact_info('address'), 'social' => implode(',', wpem_get_social_profiles())], false), 'ajax_url' => admin_url('admin-ajax.php'), 'customizer_url' => wpem_get_customizer_url(['return' => self_admin_url(), 'wpem' => 1])]);
 }