/** * Upgrade action * * @since 1.0 * * @return void */ function upgrade_action_perform() { if (!isset($_POST['dokan_upgrade_action_nonce'])) { return; } if (!wp_verify_nonce($_POST['dokan_upgrade_action_nonce'], 'dokan_upgrade_action')) { return; } if (!isset($_POST['dokan_upgrade_plugin'])) { return; } $dokan_installer = new Dokan_Installer(); $dokan_installer->do_upgrades(); // call upgrade class $redirect_url = $_SERVER['HTTP_REFERER']; wp_safe_redirect($redirect_url); }
/** * Upgrade action * * @since 1.0 * * @return void */ function upgrade_action_perform() { if (!isset($_POST['dokan_upgrade_action_nonce'])) { return; } if (!wp_verify_nonce($_POST['dokan_upgrade_action_nonce'], 'dokan_upgrade_action')) { return; } if (!isset($_POST['dokan_upgrade_plugin'])) { return; } $installed_version = get_option('dokan_theme_version'); if (version_compare($installed_version, DOKAN_PLUGIN_VERSION, '<')) { $dokan_installer = new Dokan_Installer(); $dokan_installer->create_announcement_table(); update_option('dokan_theme_version', DOKAN_PLUGIN_VERSION); $redirect_url = $_SERVER['HTTP_REFERER']; wp_safe_redirect($redirect_url); } }
/** * Placeholder for activation function * * Nothing being called here yet. */ public static function activate() { global $wpdb; $wpdb->dokan_withdraw = $wpdb->prefix . 'dokan_withdraw'; $wpdb->dokan_orders = $wpdb->prefix . 'dokan_orders'; $wpdb->dokan_announcement = $wpdb->prefix . 'dokan_announcement'; require_once __DIR__ . '/includes/functions.php'; $installer = new Dokan_Installer(); $installer->do_install(); }
/** * Doing Updates and upgrade * * @since 1.0 * * @return void */ public function do_updates() { if (isset($_GET['dokan_do_update']) && $_GET['dokan_do_update'] == 'true') { $installer = new Dokan_Installer(); $installer->do_upgrades(); } }
function install_theme() { global $pagenow; if (is_admin() && isset($_GET['activated']) && $pagenow == 'themes.php') { $installer = new Dokan_Installer(); $installer->do_install(); } }
<?php $dokan_installer = new Dokan_Installer(); $dokan_installer->create_announcement_table();