function __construct() { $this->ls_helpers = new ls_helpers(); // Load sdk when vcita is connected on front end and not in the admin area if (!is_admin() && ls_is_vcita_connected()) { add_action('wp_head', array($this, 'enqueue_front_end_script')); add_action('wp_enqueue_scripts', array($this, 'init_register_scripts')); } }
/** * Render preheader html where needed * @since 0.1.0 */ function ls_render_pre_header() { $ls_helpers = new ls_helpers(); // Check if user has connected his account to vcita $is_vcita_connected = ls_is_vcita_connected(); $settings = ls_get_settings(); // Only when vcita account is connected if ($is_vcita_connected) { // Shortcut to stored vcita params $vcita_settings = $settings['vcita_params']; $vcita_email = $vcita_settings['email']; } ?> <div class="ls-pre-header"> <?php if ($is_vcita_connected) { ?> <span>Logged in as: </span> <a class="ls-pre-header__email" href="mailto: <?php echo $vcita_email; ?> "> <?php echo $vcita_email; ?> </a> <span> | </span> <?php } ?> <span><?php _e('Rate us', 'livesite'); ?> : </span> <a class="ls-pre-header__rate-link" href="https://wordpress.org/support/view/plugin-reviews/contact-form-with-a-meeting-scheduler-by-vcita?filter=5" target="_blank"> <span class="icon-Rate"></span><!-- --><span class="icon-Rate"></span><!-- --><span class="icon-Rate"></span><!-- --><span class="icon-Rate"></span><!-- --><span class="icon-Rate"></span></a> <a href="https://www.vcita.com/home?<?php echo $ls_helpers->get_plugin_identifier(); ?> " target="_blank" class="ls-pre-header__logo"></a> </div> <?php }
/** * Render footer html where needed * @since 0.1.0 */ function ls_render_footer() { $ls_helpers = new ls_helpers(); // Check if user has connected his account to vcita $is_vcita_connected = ls_is_vcita_connected(); ?> <div class="ls-footer"> <ul class="ls-footer-menu"> <?php if ($is_vcita_connected) { ?> <li class="ls-footer-menu__item"> <a href="//www.vcita.com/account?<?php echo $ls_helpers->get_plugin_identifier(); ?> " target="_blank" class="ls-footer-menu__link">Account</a> </li> <?php } ?> <li class="ls-footer-menu__item"> <a data-open-popup href="<?php echo $ls_helpers->get_settings_page_url('business'); ?> " class="ls-footer-menu__link">Settings</a> </li> <?php if ($is_vcita_connected) { ?> <li class="ls-footer-menu__item"> <a href="?page=live-site-reset-plugin" class="ls-footer-menu__link js-vcita-disconnect">Disconnect</a> </li> <?php } ?> <li class="ls-footer-menu__item"> <a href="https://wordpress.org/support/view/plugin-reviews/paypal-payment-button-by-vcita?filter=5" target="_blank" class="ls-footer-menu__link">Rate US</a> </li> <li class="ls-footer-menu__item"> <a href="https://support.vcita.com/home" target="_blank" class="ls-footer-menu__link">Support</a> </li> </ul> </div> <?php }
/** * Settings Page Callback * used in ls_settings_setup(). * @since 0.1.0 */ function ls_settings_page() { /* global vars */ global $hook_suffix; $ls_helpers = $this->ls_helpers; $modules = ls_get_modules(); // When plugin is not connected to vcita get admin email to populate email signup field $admin_email = get_option('admin_email', ''); // Check if user has connected his account to vcita $is_vcita_connected = ls_is_vcita_connected(); $plugin_page_url = $ls_helpers->get_plugin_page_url('live-site-backoffice'); $main_module = ls_get_main_module(); $main_title = ''; // Partner url $partner_url = 'https://www.vcita.com/partners?' . $ls_helpers->get_plugin_identifier(); if ($main_module) { $module_data = ls_get_module_data($main_module); $module_main_title = $module_data['main_title']; $module_text = $module_data['text']; } ?> <div class="wrap ls-wrap"> <?php settings_errors(); ?> <?php ls_render_pre_header(); ?> <div class="ls-header"> <div class="ls-header__decoration"></div> <div class="ls-header__main-decoration"></div> <div class="ls-header__wrap"> <div class="ls-header__title"><?php _e($module_main_title, 'livesite'); ?> </div> <div class="ls-header__text-wrap"> <span class="ls-header__text-title"><?php _e('Part of', 'livesite'); ?> </span> <span class="ls-header__text-icon icon-Livesite"></span> <span class="ls-header__text"><?php _e('vCita LiveSite Pack', 'livesite'); ?> </span> </div> </div> </div> <?php if (!$is_vcita_connected) { ?> <div class="ls-section text-center"> <input class="connect-email-input" placeholder="*****@*****.**" type="text" name="connect-email" id="connect-email" value="<?php echo $admin_email; ?> "> <a class="ls-button--central js-vcita-connect"><?php _e('Connect to Get Started', 'livesite'); ?> </a> </div> <?php } ?> <div class="ls-section text-center"> <div class="ls-small-text push-down-1"><?php echo $module_main_title . ' ' . __('is part of vCita LiveSite Pack', 'livesite'); ?> </div> <strong class="ls-section__title"><?php _e('Your LiveSite Modules:', 'livesite'); ?> </strong> <ul class="ls-modules"> <?php foreach ($modules as $module_key => $module) { $module_classes = ''; $module_classes .= $is_vcita_connected ? '' : ' ls-modules__module--disabled'; $module_classes .= $module['active'] ? ' ls-modules__module--active' : ''; $module_classes .= $module['active'] && $is_vcita_connected ? ' js-ls-modules__module' : ''; ?> <li class="ls-modules__module <?php echo $module_classes; ?> "> <span class="ls-modules__module-icon <?php echo $module['icon']; ?> "></span> <div class="ls-modules__module-content"> <strong class="ls-modules__module-title"><?php echo $module['title']; ?> </strong> <div class="ls-modules__module-text"><?php echo $module['text']; ?> </div> <?php if (!$module['active']) { ?> <button class="button button-primary <?php echo $is_vcita_connected ? 'js-ls-modules__module-button' : 'button-disabled'; ?> " data-module-name="<?php echo $module_key; ?> "> <?php _e('Add', 'livesite'); ?> </button> <?php } else { if ($is_vcita_connected) { ?> <a href="<?php echo $ls_helpers->get_plugin_page_url($module['slug']); ?> " class="button button-primary js-ls-modules__module-button--edit <?php echo $is_vcita_connected ? '' : 'button-disabled'; ?> "> <?php _e('Edit', 'livesite'); ?> </a> <?php } } ?> </div> </li><?php } ?> </ul> </div> <div class="ls-section ls-section--last text-center"> <strong class="ls-section__title push-down-3"><?php _e('One Platform which enables all modules', 'livesite'); ?> </strong> <div class="ls-promotions"> <div class="ls-promotions__promotion<?php echo $is_vcita_connected ? '' : ' ls-promotions__promotion--disabled'; ?> "> <div class="ls-promotions__icon ls-promotions__promotion--color-1"> <span class="icon-Optimization"></span> </div> <div class="ls-promotions__title"><?php _e('Backoffice', 'livesite'); ?> </div> <div class="ls-promotions__text"><?php _e('All livesite modules plug into a single business management dashboard', 'livesite'); ?> </div> <a <?php echo $is_vcita_connected ? 'href="' . $plugin_page_url . '"' : ''; ?> class="ls-promotions__url"><?php _e('Go to Backoffice', 'livesite'); ?> </a> </div><!-- --><div class="ls-promotions__promotion"> <div class="ls-promotions__icon ls-promotions__promotion--color-2"> <span class="icon-Code-Window"></span> </div> <div class="ls-promotions__title"><?php _e('SDK for Developers', 'livesite'); ?> </div> <div class="ls-promotions__text"><?php _e('To achieve maximum flexibility use our LiveSite SDK', 'livesite'); ?> </div> <a href="//developers.vcita.com/" target="_blank" class="ls-promotions__url"><?php _e('Go to SDK Documentation', 'livesite'); ?> </a> </div><!-- --><div class="ls-promotions__promotion"> <div class="ls-promotions__icon ls-promotions__promotion--color-3"> <span class="icon-Partners"></span> </div> <div class="ls-promotions__title"><?php _e('Partner Program', 'livesite'); ?> </div> <div class="ls-promotions__text"><?php _e('Join over 8500 partners who leverage the vCita web engagement solution to extend their brand', 'livesite'); ?> </div> <a href="<?php echo $partner_url; ?> " target="_blank" class="ls-promotions__url"><?php _e('Learn More', 'livesite'); ?> </a> </div> </div> </div> <?php ls_render_footer(); ?> </div> <?php }