theme = $theme;
$theme = wp_get_theme();
$arr = array(
'theme-name' => $theme->get( 'Name' ),
'theme-slug' => $theme->get( 'TextDomain' ),
'theme-version' => $theme->get( 'Version' ),
);
$this->theme = wp_parse_args( $this->theme, $arr );
}
/**
* @param array $theme
*
* @return MedZone_Lite_Dashboard_Setup
*/
public static function get_instance( $theme = array() ) {
static $inst;
if ( ! $inst ) {
$inst = new MedZone_Lite_Dashboard_Setup( $theme );
}
return $inst;
}
/**
* Adds an admin notice in the backend
*
* If the Epsilon Notification class does not exist, we stop
*/
public function add_admin_notice() {
if ( ! class_exists( 'Epsilon_Notifications' ) ) {
return;
}
if ( ! empty( $_GET ) && isset( $_GET['page'] ) && 'epsilon-onboarding' === $_GET['page'] ) {
return;
}
$used_onboarding = get_theme_mod( $this->theme['theme-slug'] . '_used_onboarding', false );
if ( $used_onboarding ) {
return;
}
$imported_demo = MedZone_Lite_Notify_System::check_installed_data();
if ( $imported_demo ) {
return;
}
if ( empty( $this->notice ) ) {
$this->notice .= '';
/* Translators: Notice Title */
$this->notice .= '
'; $this->notice .= sprintf( /* Translators: Notice */ esc_html__( 'Welcome! Thank you for choosing %3$s! To fully take advantage of the best our theme can offer please make sure you visit our %1$swelcome page%2$s.', 'medzone-lite' ), '', '', $this->theme['theme-name'] ); $this->notice .= '
'; /* Translators: Notice URL */ $this->notice .= '' . sprintf( esc_html__( 'Get started with %1$s', 'medzone-lite' ), $this->theme['theme-name'] ) . '
'; } $notifications = Epsilon_Notifications::get_instance(); $notifications->add_notice( array( 'id' => 'notification_testing', 'type' => 'notice epsilon-big', 'message' => $this->notice, ) ); } /** * Edd params * * @return array */ public function get_edd( $setup = array() ) { $options = get_option( $setup['theme']['theme-slug'] . '_license_object', array() ); $options = wp_parse_args( $options, array( 'expires' => false, 'licenseStatus' => false, ) ); return array( 'license' => trim( get_option( $setup['theme']['theme-slug'] . '_license_key', false ) ), 'licenseOption' => $setup['theme']['theme-slug'] . '_license_key', 'downloadId' => '221300', 'expires' => $options['expires'], 'status' => $options['licenseStatus'] ); } /** * Onboarding steps * * @return array */ public function get_steps() { return array( array( 'id' => 'landing', 'title' => __( 'Welcome to MedZone Lite', 'medzone-lite' ), 'content' => array( 'paragraphs' => array( __( ' This wizard will set up your theme, install plugins and import demo content. It is optional & should take less than a minute.', 'medzone-lite' ), ), ), 'progress' => __( 'Getting Started', 'medzone-lite' ), 'buttons' => array( 'next' => array( 'action' => 'next', 'label' => __( 'Let\'s get started ', 'medzone-lite' ), ), ), ), array( 'id' => 'plugins', 'title' => __( 'Install Recommended Plugins', 'medzone-lite' ), 'content' => array( 'paragraphs' => array( __( 'MedZone Lite integrates tightly with a few plugins that we recommend installing to get the full theme experience, as we\'ve intended it to be. This is an optional step, but we recommend installing them as we think these hand-picked plugins work really nice with MedZone Lite and help enhance the overall experience.', 'medzone-lite' ), ), ), 'progress' => __( 'Plugins', 'medzone-lite' ), 'buttons' => array( 'next' => array( 'action' => 'next', 'label' => __( 'Next ', 'medzone-lite' ), ), ), ), array( 'id' => 'demos', 'title' => __( 'Import Demo Content', 'medzone-lite' ), 'content' => array( 'paragraphs' => array( wp_kses_post( __( 'We\'ve made it easy for you to get up and running in a jiffy. Just pick any of the theme demos below, click on Select, Import and you\'ll be ready in no time. Feel free to skip this step if you\'d like to create the content yourself.', 'medzone-lite' ) ), wp_kses_post( __( 'Note: This is the easiest way to see what goes where. After you\'ve finished the import, you can edit the content using the built-in Customizer, available under Appearance -> Customize.', 'medzone-lite' ) ) ), ), 'progress' => __( 'Demos', 'medzone-lite' ), 'demos' => get_template_directory() . '/inc/customizer/demo/demo.json', 'buttons' => array( 'next' => array( 'action' => 'next', 'label' => __( 'Next ', 'medzone-lite' ), ), ), ), array( 'id' => 'enjoy', 'title' => __( 'Almost ready', 'medzone-lite' ), 'content' => array( 'paragraphs' => array( __( 'Your new theme has been all set up. Enjoy your new theme by MachoThemes.', 'medzone-lite' ), __( 'Opt-in to tracking and our newsletter and immediately be emailed a discount coupon to the MachoThemes shop. No sensitive data is tracked.', 'medzone-lite' ), ), ), 'progress' => __( 'Finished', 'medzone-lite' ), 'fields' => array( array( 'id' => $this->theme['theme-slug'] . '_tracking_enable', 'type' => 'epsilon-toggle', 'value' => true, 'label' => esc_html__( 'Allow MachoThemes to track theme usage?', 'medzone-lite' ), 'checked' => get_option( $this->theme['theme-slug'] . '_tracking_enable', true ), ), ), 'buttons' => array( 'next' => array( 'action' => 'customizer', 'label' => __( 'Finish', 'medzone-lite' ), ), ), ), ); } /** * @param bool $integrated * * @return array */ public function get_plugins( $integrated = false ) { $arr = array( 'contact-form-7' => array( 'integration' => true, 'recommended' => false, ), 'kiwi-social-share' => array( 'integration' => false, 'recommended' => false, ), 'modula-best-grid-gallery' => array( 'integration' => false, 'recommended' => true, ), ); if ( ! $integrated ) { unset( $arr['contact-form-7'] ); } return $arr; } /** * Dashboard actions */ public function get_actions() { if ( is_customize_preview() ) { return $this->_customizer_actions(); } return array( array( 'id' => 'medzone-import-data', 'title' => esc_html__( 'Add sample content', 'medzone-lite' ), 'description' => esc_html__( 'Clicking the button below will add content/sections/settings and recommended plugins to your WordPress installation. Click advanced to customize the import process in the dedicated tab.', 'medzone-lite' ), 'check' => MedZone_Lite_Notify_System::check_installed_data(), 'state' => false, 'actions' => array( array( 'label' => esc_html__( 'Advanced', 'medzone-lite' ), 'type' => 'change-page', 'handler' => 'epsilon-demo', ), ), ), array( 'id' => 'medzone-check-cf7', 'title' => MedZone_Lite_Notify_System::plugin_verifier( 'contact-form-7', 'title', 'Contact Form 7', 'verify_cf7' ), 'description' => MedZone_Lite_Notify_System::plugin_verifier( 'contact-form-7', 'description', 'Contact Form 7', 'verify_cf7' ), 'plugin_slug' => 'contact-form-7', 'state' => false, 'check' => defined( 'WPCF7_VERSION' ), 'actions' => array( array( 'label' => MedZone_Lite_Notify_System::plugin_verifier( 'contact-form-7', 'installed', 'Contact Form 7', 'verify_cf7' ) ? __( 'Activate Plugin', 'medzone-lite' ) : __( 'Install Plugin', 'medzone-lite' ), 'type' => 'handle-plugin', 'handler' => MedZone_Lite_Notify_System::plugin_verifier( 'contact-form-7', 'installed', 'Contact Form 7', 'verify_cf7' ), ), ), ), ); } /** * Render customizer actions */ private function _customizer_actions() { return array( array( 'id' => 'medzone-import-data', 'title' => esc_html__( 'Add sample content', 'medzone-lite' ), 'description' => esc_html__( 'Clicking the button below will add content/sections/settings and recommended plugins to your WordPress installation. Click advanced to customize the import process in the dedicated tab.', 'medzone-lite' ), 'check' => MedZone_Lite_Notify_System::check_installed_data(), 'help' => '' . __( 'Import Demo Content', 'medzone-lite' ) . '', ), array( 'id' => 'medzone-check-cf7', 'title' => MedZone_Lite_Notify_System::plugin_verifier( 'contact-form-7', 'title', 'Contact Form 7', 'verify_cf7' ), 'description' => MedZone_Lite_Notify_System::plugin_verifier( 'contact-form-7', 'description', 'Contact Form 7', 'verify_cf7' ), 'plugin_slug' => 'contact-form-7', 'check' => defined( 'WPCF7_VERSION' ), ), ); } /** * Welcome Screen tabs * * @param $setup array * * @return array */ public function get_tabs( $setup = array() ) { $theme = wp_get_theme(); return array( array( 'id' => 'epsilon-getting-started', 'title' => esc_html__( 'Getting Started', 'medzone-lite' ), 'hidden' => false, 'type' => 'info', 'content' => array( array( 'title' => esc_html__( 'Step 1 - Implement recommended actions', 'medzone-lite' ), 'paragraph' => esc_html__( 'We compiled a list of steps for you, to take make sure the experience you will have using one of our products is very easy to follow.', 'medzone-lite' ), 'action' => '' . __( 'Launch wizard', 'medzone-lite' ) . '', ), array( 'title' => esc_html__( 'Step 2 - Check our documentation', 'medzone-lite' ), 'paragraph' => esc_html__( 'Even if you are a long-time WordPress user, we still believe you should give our documentation a very quick Read.', 'medzone-lite' ), 'action' => '' . __( 'Full documentation', 'medzone-lite' ) . '', ), array( 'title' => esc_html__( 'Step 3 - Customize everything', 'medzone-lite' ), 'paragraph' => esc_html__( 'Using the WordPress Customizer you can easily customize every aspect of the theme.', 'medzone-lite' ), 'action' => '' . esc_html__( 'Go to Customizer', 'medzone-lite' ) . '', ), array( 'title' => esc_html__( 'Lend a hand and share your thoughts', 'medzone-lite' ), 'paragraph' => vsprintf( // Translators: 1 is Theme Name, 2 is opening Anchor, 3 is closing. __( 'We worked hard on making %1$s the best one out there. We are interested in hearing your thoughts about %1$s and what we could do to make it even better.