Esempio n. 1
0
wp_enqueue_script('jquery');
wp_enqueue_script('json2');
fs_enqueue_local_script('postmessage', 'nojquery.ba-postmessage.min.js');
fs_enqueue_local_script('fs-postmessage', 'postmessage.js');
fs_enqueue_local_style('fs_common', '/admin/common.css');
$slug = $VARS['slug'];
$fs = freemius($slug);
$timestamp = time();
$context_params = array('plugin_id' => $fs->get_id(), 'plugin_public_key' => $fs->get_public_key(), 'plugin_version' => $fs->get_plugin_version());
// Get site context secure params.
if ($fs->is_registered()) {
    $site = $fs->get_site();
    $plugin_id = fs_request_get('plugin_id', $fs->get_id());
    if ($plugin_id != $fs->get_id()) {
        if ($fs->is_addon_activated($plugin_id)) {
            $fs_addon = Freemius::get_instance_by_id($plugin_id);
            $site = $fs_addon->get_site();
        }
    }
    $context_params = array_merge($context_params, FS_Security::instance()->get_context_params($site, $timestamp, 'checkout'));
} else {
    $current_user = Freemius::_get_current_wp_user();
    // Add site and user info to the request, this information
    // is NOT being stored unless the user complete the purchase
    // and agrees to the TOS.
    $context_params = array_merge($context_params, array('user_firstname' => $current_user->user_firstname, 'user_lastname' => $current_user->user_lastname, 'user_email' => $current_user->user_email));
    $fs_user = Freemius::_get_user_by_email($current_user->user_email);
    if (is_object($fs_user)) {
        $context_params = array_merge($context_params, FS_Security::instance()->get_context_params($fs_user, $timestamp, 'checkout'));
    }
}