示例#1
0
 /**
  * Load front facing stylesheet
  * @since 0.1.0
  */
 function init_register_scripts()
 {
     $ls_helpers = $this->ls_helpers;
     $path = $ls_helpers->get_dir(__FILE__);
     $vcita_params = ls_get_vcita_params();
     $livesite_widget_module = ls_get_module_data('livesite_widget');
     $ls_helpers->register_scripts(array('livesite_sdk' => array('path' => $path . '../js/livesite-include-sdk.js', 'params' => array('ls_sdk_uid' => $vcita_params['uid'], 'ls_sdk_show_livesite' => $livesite_widget_module['show_livesite']))));
 }
示例#2
0
 function __construct()
 {
     $this->module_name = 'livesite_widget';
     $this->module_data = ls_get_module_data($this->module_name);
     $this->module_slug = $this->module_data['slug'];
     $this->ls_helpers = new ls_helpers();
     /* Add Settings Page */
     add_action('admin_menu', array($this, 'settings_page_setup'), 11, 0);
     /* Add Meta Box */
     add_action('add_meta_boxes', array($this, 'top_settings_metabox'));
     add_action('add_meta_boxes', array($this, 'main_metabox'));
     add_action('add_meta_boxes', array($this, 'ls_advanced_options'));
 }
示例#3
0
/**
* Settings
* Activates module using ajax call
* @since 0.1.0
*/
function ls_remote_activate_module()
{
    $nonce = $_POST['nonce'];
    $return = array('status' => false);
    // check to see if the submitted nonce matches with the
    // generated nonce we created earlier
    if (!wp_verify_nonce($nonce, 'activate-module')) {
        die('Unauthorized attempt');
    }
    // If you need to pass in extra information
    $module_name = $_POST['module_name'];
    if (isset($module_name) && $module_name != '') {
        ls_activate_module($module_name);
        $module_data = ls_get_module_data($module_name);
        $return['module_slug'] = $module_data['slug'];
        $return['status'] = true;
    }
    header("Content-Type: application/json");
    echo json_encode($return);
    exit;
}
示例#4
0
    /**
     * 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 
    }
示例#5
0
 /**
  * Load Script Needed For Meta Box
  * @since 0.1.0
  */
 function enqueue_scripts($hook_suffix)
 {
     $ls_helpers = $this->ls_helpers;
     $path = $ls_helpers->get_dir(__FILE__);
     $page_hook_id = $this->get_setings_page_id();
     $module_name = $this->module_name;
     $module_data = ls_get_module_data($module_name);
     if ($hook_suffix == $page_hook_id) {
         // register scripts
         $ls_helpers->register_scripts(array('custom_page' => array('path' => $path . '../js/custom-page.js', 'params' => array('ls_pm_module_nonce' => wp_create_nonce('module-page'), 'ls_pm_module_name' => $module_name, 'ls_pm_page_title' => $module_data['custom_page_title'], 'ls_pm_page_content' => $ls_helpers->get_random_page_content($module_data['custom_page_content']), 'ls_pm_page_id' => $module_data['custom_page_id']))));
         wp_enqueue_script('common');
         wp_enqueue_script('wp-lists');
         wp_enqueue_script('postbox');
         wp_enqueue_script('livesite');
         // Load script in footer
         wp_enqueue_script('custom_page', '', '', '', true);
     }
 }
示例#6
0
 /**
  * Utility: Helper
  * Create a custom page for the given module once per plugin init
  *
  * @param: $module_name{String},
  * @return: String
  * @since 0.1.0
  */
 function generate_custom_page_once($module_name = false)
 {
     if ($module_name) {
         $module_data = ls_get_module_data($module_name);
         // Get custom page id returns false if does not exist
         $custom_page_id = $module_data['custom_page_id'];
         $custom_page_previously_created = $module_data['custom_page_previously_created'];
         // If custom page id does not exist and was not previously created
         if (!$custom_page_id && !$custom_page_previously_created) {
             // Get random content method knows how to handle single string and array
             $custom_page_content = $this->get_random_page_content($module_data['custom_page_content']);
             // Add the modules custom page
             $page_id = $this->add_wp_page($module_data['custom_page_title'], $custom_page_content);
             // Only if page was added define the new page id in the plugins settings
             if ($page_id) {
                 ls_set_settings(array('modules' => array($module_name => array('custom_page_id' => $page_id, 'custom_page_previously_created' => true))));
             }
         }
         return $custom_page_previously_created;
     }
 }