Example #1
0
function gwolle_gb_installSplash()
{
    ?>
	<div class="wrap">
		<div id="icon-gwolle-gb"><br /></div>
		<h1>Gwolle-GB &#8212;
			<?php 
    _e('Installation', 'gwolle-gb');
    ?>
		</h1>

		<div>
			<?php 
    if (!isset($_REQUEST['install_gwolle_gb']) || $_REQUEST['install_gwolle_gb'] != 'install_gwolle_gb') {
        _e('Welcome!<br>It seems that either you\'re using this plugin for the first time or you\'ve deleted all settings.<br>However, to use this plugin we have to setup the database tables. Good for you, we\'ve made this as easy as possible.<br>All you\'ve got to do is click on that button below, and that\'s it.', 'gwolle-gb');
        ?>
				<br /><br />
				<div>
					<form action="<?php 
        echo $_SERVER['PHP_SELF'] . '?page=' . $_REQUEST['page'];
        ?>
" method="POST">
						<input type="hidden" id="install_gwolle_gb" name="install_gwolle_gb" value="install_gwolle_gb" />
						<input type="submit" class="button button-primary" value="<?php 
        esc_attr_e('Sure, let\'s do this!', 'gwolle-gb');
        ?>
">
					</form>
				</div>
				<?php 
    } elseif (isset($_REQUEST['install_gwolle_gb']) && $_REQUEST['install_gwolle_gb'] == 'install_gwolle_gb' && !get_option('gwolle_gb_version')) {
        // perform installation
        gwolle_gb_install();
        echo sprintf(__('Allright, we\'re done. <a href="%s">Click here to continue...</a>', 'gwolle-gb'), $_SERVER['PHP_SELF'] . '?page=' . $_REQUEST['page']);
    } else {
        echo sprintf(__('It looks like there has been an error. <a href="%s">Click here to continue...</a>', 'gwolle-gb'), $_SERVER['PHP_SELF'] . '?page=' . $_REQUEST['page']);
    }
    ?>
		</div>
	</div>
	<?php 
}
Example #2
0
function gwolle_gb_activate_new_site($blog_id)
{
    switch_to_blog($blog_id);
    gwolle_gb_install();
    restore_current_blog();
}
Example #3
0
function gwolle_gb_activation($networkwide)
{
    global $wpdb;
    $current_version = get_option('gwolle_gb_version');
    if (function_exists('is_multisite') && is_multisite()) {
        $blogids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
        foreach ($blogids as $blog_id) {
            switch_to_blog($blog_id);
            if ($current_version == false) {
                gwolle_gb_install();
            } elseif ($current_version != GWOLLE_GB_VER) {
                gwolle_gb_upgrade();
            }
            restore_current_blog();
        }
    } else {
        if ($current_version == false) {
            gwolle_gb_install();
        } elseif ($current_version != GWOLLE_GB_VER) {
            gwolle_gb_upgrade();
        }
    }
}