Exemple #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']))));
 }
Exemple #2
0
 /**
  * Create Settings Page
  * @since 0.1.0
  */
 function ls_settings_setup()
 {
     $ls_helpers = $this->ls_helpers;
     // Setup small link on wordpress plugins page that directs user to settings page
     add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
     /* Add settings menu page */
     $settings_page = add_menu_page('LiveSite Pack', 'LiveSite', 'manage_options', 'live-site', array($this, 'ls_settings_page'), plugin_dir_url(__FILE__) . 'images/vcita-icon.png', '2.3489');
     $os = $ls_helpers->get_os();
     // For popular os (unix)
     if ($os != 'win32') {
         define('LS_SLASH', '/');
     } else {
         define('LS_SLASH', '\\');
     }
     // If settings don't exist in db set them up from defaults
     if (!ls_get_settings()) {
         ls_init_default_settings();
     }
     // Check if vcita is not connected
     // If old connection details are in place use them
     if (!ls_is_vcita_connected()) {
         $old_plugin_db_key = $ls_helpers->get_old_plugin_db_key();
         // Get old plugin connection details
         $old_connection_options = get_option($old_plugin_db_key);
         // Setup connection details
         if ($old_connection_options) {
             ls_parse_old_plugin_params($old_connection_options);
             // Flag plugin as upgraded plugin so we know not to auto install module pages
             ls_set_settings(array('plugin_upgraded' => true));
             $vcita_params = ls_get_vcita_params();
             // Set value of active engage widget to the same value as the old plugin
             if (isset($vcita_params['engage_active'])) {
                 ls_set_module_data('livesite_widget', array('show_livesite' => $vcita_params['engage_active']));
             }
             $redirect_url = $ls_helpers->get_plugin_path();
             wp_redirect($redirect_url);
             exit;
         }
     }
     // Only show modules and settings if we're connected to vcita
     if (ls_is_vcita_connected()) {
         require_once 'system/settings_page.php';
         require_once 'system/backoffice_page.php';
         $this->init_modules();
         $main_module = ls_get_main_module();
         $settings = ls_get_settings();
         // For a one time redirect after vcita connect
         if (!$settings['plugin_initially_activated']) {
             // Set plugin as already activated, this only allows it to happen once when we connect to vcita
             ls_set_settings(array('plugin_initially_activated' => true));
             // Get main module data
             $module_data = ls_get_module_data($main_module);
             // Redirect to main module page
             $plugin_page_url = $ls_helpers->get_plugin_page_url($module_data['slug']);
             wp_redirect($plugin_page_url);
             exit;
         }
     }
     /* Vars */
     $page_hook_id = $this->setings_page_id();
     /* Do stuff in settings page, such as adding scripts, etc. */
     if (!empty($settings_page)) {
         /* Load the JavaScript needed for the settings screen. */
         add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
         add_action('admin_enqueue_scripts', array($this, 'enqueue_styles'));
     }
 }
Exemple #3
0
    /**
     * Payment Settings meta box markup
     * @since 0.1.0
     */
    function main_metabox_markup()
    {
        $ls_helpers = $this->ls_helpers;
        $vcita_params = ls_get_vcita_params();
        $implementation_key = $vcita_params['implementation_key'];
        ?>

	<table class="form-table">
		<tr>
			<td> <?php 
        _e('Contact Form ShortCode', 'livesite');
        ?>
</td>
			<td>
				<code>[livesite-contact title="Contact request" class="&lt;your-custom-class&gt;"]</code>
			</td>
		</tr>
	</table>

	<iframe class="js-iframe"
			src="//www.vcita.com/widget_implementations?platform=wordpress&widget=contact_form&key=<?php 
        echo $implementation_key;
        ?>
"
			width="980"
			height="100%"></iframe>


	<table class="form-table">
		<tr>
			<td>
				<?php 
        _e('**Use LiveSite SDK to add any LiveSite action to any element on your site', 'livesite');
        ?>
				-
				<a href="//developers.vcita.com/" target="_blank"><?php 
        _e('Access SDK documentation', 'livesite');
        ?>
</a>
			</td>
		</tr>
	</table>

	<?php 
    }
    /**
     * Payment Settings meta box markup
     * @since 0.1.0
     */
    function main_metabox_markup()
    {
        $vcita_params = ls_get_vcita_params();
        $implementation_key = $vcita_params['implementation_key'];
        ?>

	<iframe class="js-iframe"
			src="//www.vcita.com/widget_implementations?platform=wordpress&widget=active_engage&key=<?php 
        echo $implementation_key;
        ?>
"
			width="980"
			height="100%"></iframe>


	<table class="form-table">
		<tr>
			<td>
				<?php 
        _e('**Use LiveSite SDK to add any LiveSite action to any element on your site', 'livesite');
        ?>
				-
				<a href="//developers.vcita.com/"><?php 
        _e('Access SDK documentation', 'livesite');
        ?>
</a>
			</td>
		</tr>
	</table>

	<?php 
    }