Exemple #1
0
 /**
  * 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);
     }
 }
<?php

$dokan_installer = new Dokan_Installer();
$dokan_installer->create_announcement_table();