コード例 #1
0
ファイル: globals.php プロジェクト: sumwander/unyil
function wptouch_free_upgrade_plugin()
{
    global $wptouch_pro;
    $wptouch_pro->bnc_api = false;
    $settings = wptouch_get_settings('bncid');
    $wptouch_pro->setup_bncapi($settings->bncid, $settings->wptouch_license_key, true);
    $bnc_api = $wptouch_pro->get_bnc_api();
    $plugin_name = 'wptouch/wptouch.php';
    // Check for WordPress 3.0 function
    if (function_exists('is_super_admin')) {
        $option = get_site_transient('update_plugins');
    } else {
        $option = function_exists('get_transient') ? get_transient('update_plugins') : get_option('update_plugins');
    }
    $version_available = false;
    $latest_info = $bnc_api->get_product_version();
    if ($latest_info && $latest_info['version'] != WPTOUCH_VERSION) {
        WPTOUCH_DEBUG(WPTOUCH_INFO, 'A new product update is available [' . $latest_info['version'] . ']');
        if (isset($latest_info['upgrade_url']) && wptouch_has_license()) {
            if (!isset($option->response[$plugin_name])) {
                $option->response[$plugin_name] = new stdClass();
            }
            // Update upgrade options
            $option->response[$plugin_name]->url = 'http://www.wptouch.com/';
            $option->response[$plugin_name]->package = $latest_info['upgrade_url'];
            $option->response[$plugin_name]->new_version = $latest_info['version'];
            $option->response[$plugin_name]->id = '0';
            $option->response[$plugin_name]->slug = WPTOUCH_ROOT_NAME;
        } else {
            if (is_object($option) && isset($option->response)) {
                unset($option->response[$plugin_name]);
            }
        }
        $wptouch_pro->latest_version_info = $latest_info;
        $upgrade_available = $latest_info['version'];
    } else {
        if (is_object($option) && isset($option->response)) {
            unset($option->response[$plugin_name]);
        }
    }
    if (isset($option->response[$plugin_name])) {
        // WordPress 3.0 changed some stuff, so we check for a WP 3.0 function
        if (function_exists('is_super_admin')) {
            set_site_transient('update_plugins', $option);
        } else {
            if (function_exists('set_transient')) {
                set_transient('update_plugins', $option);
            }
        }
        // Do Upgrade
        include_once ABSPATH . 'wp-admin/includes/admin.php';
        include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
        $upgrader = new Plugin_Upgrader(new Automatic_Upgrader_Skin());
        $upgrader->upgrade('wptouch/wptouch.php');
        if (is_array($upgrader->skin->result)) {
            deactivate_plugins('wptouch/wptouch.php');
            $new_plugin_identifier = 'wptouch-pro/wptouch-pro.php';
            $active_plugins = get_option('active_plugins', array());
            if (!in_array($new_plugin_identifier, $active_plugins)) {
                $active_plugins[] = $new_plugin_identifier;
                update_option('active_plugins', $active_plugins);
            }
            return '1';
        } else {
            return '0';
        }
    } else {
        return '0';
    }
}
コード例 #2
0
							<?php 
                if (wptouch_theme_info_url()) {
                    ?>
							<a class="button-secondary" href="<?php 
                    echo wptouch_theme_info_url();
                    ?>
"><?php 
                    _e('More Info', 'wptouch-pro');
                    ?>
</a>
							<?php 
                }
                ?>

							<?php 
                if (wptouch_has_license()) {
                    ?>
							<a class="button-secondary buynow" href="<?php 
                    wptouch_the_theme_buy_url();
                    ?>
"><?php 
                    _e('Upgrade License', 'wptouch-pro');
                    ?>
</a>
							<?php 
                } else {
                    ?>
							<a class="button-secondary buynow" href="<?php 
                    wptouch_the_theme_buy_url();
                    ?>
"><?php 
コード例 #3
0
						WPtouch Pro Unlicensed
					<?php 
} else {
    ?>
						<?php 
    echo $bncid_info->license_friendly_name;
    ?>
					<?php 
}
?>
				</h5>
			</td>
		</tr>

	<?php 
if (defined('WPTOUCH_IS_FREE') || !wptouch_has_license()) {
    ?>
		<tr>
			<td colspan="2">
				<div id="license-settings-area">
					<input type="text" placeholder="<?php 
    _e('Account E-Mail Address', 'wptouch-pro');
    ?>
" id="license_email" name="<?php 
    echo wptouch_admin_get_manual_encoded_setting_name('bncid', 'bncid');
    ?>
" value="<?php 
    if ($settings->bncid) {
        echo $settings->bncid;
    } else {
        '';
コード例 #4
0
function wptouch_pro_check_for_update()
{
    global $wptouch_pro;
    $upgrade_available = WPTOUCH_VERSION;
    $wptouch_pro->setup_bncapi();
    $bnc_api = $wptouch_pro->get_bnc_api();
    $plugin_name = WPTOUCH_ROOT_NAME . '/wptouch-pro.php';
    WPTOUCH_DEBUG(WPTOUCH_INFO, 'Checking BNC server for a new product update');
    // Check for WordPress 3.0 function
    if (function_exists('is_super_admin')) {
        $option = get_site_transient('update_plugins');
    } else {
        $option = function_exists('get_transient') ? get_transient('update_plugins') : get_option('update_plugins');
    }
    $version_available = false;
    if (false === ($latest_info = get_site_transient('_wptouch_bncid_latest_version'))) {
        $latest_info = $bnc_api->get_product_version();
        set_site_transient('_wptouch_bncid_latest_version', $latest_info, WPTOUCH_API_GENERAL_CACHE_TIME);
    }
    if ($latest_info && $latest_info['version'] != WPTOUCH_VERSION) {
        WPTOUCH_DEBUG(WPTOUCH_INFO, 'A new product update is available [' . $latest_info['version'] . ']');
        if (isset($latest_info['upgrade_url']) && wptouch_has_license()) {
            if (!isset($option->response[$plugin_name])) {
                $option->response[$plugin_name] = new stdClass();
            }
            // Update upgrade options
            $option->response[$plugin_name]->url = 'http://www.wptouch.com/';
            $option->response[$plugin_name]->package = $latest_info['upgrade_url'];
            $option->response[$plugin_name]->new_version = $latest_info['version'];
            $option->response[$plugin_name]->id = '0';
            $option->response[$plugin_name]->slug = WPTOUCH_ROOT_NAME;
        } else {
            if (is_object($option) && isset($option->response)) {
                unset($option->response[$plugin_name]);
            }
        }
        $wptouch_pro->latest_version_info = $latest_info;
        $upgrade_available = $latest_info['version'];
    } else {
        if (is_object($option) && isset($option->response)) {
            unset($option->response[$plugin_name]);
        }
    }
    // WordPress 3.0 changed some stuff, so we check for a WP 3.0 function
    if (function_exists('is_super_admin')) {
        set_site_transient('update_plugins', $option);
    } else {
        if (function_exists('set_transient')) {
            set_transient('update_plugins', $option);
        }
    }
    return $upgrade_available;
}
コード例 #5
0
function wptouch_has_proper_auth()
{
    wptouch_has_license();
    $settings = wptouch_get_settings();
    return $settings->last_bncid_licenses;
}