/**
  * Create and return the class object.
  *
  * @access  public
  * @static
  * @since   1.3.0
  */
 public static function get_instance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new Charitable_Upgrade();
     }
     return self::$instance;
 }
/**
 * Trigger an upgrade via AJAX.
 *
 * @see     Charitable_Upgrade::trigger_ajax_upgrade()
 */
// add_action( 'wp_ajax_trigger_ajax_upgrade', array( 'Charitable_Upgrade', 'trigger_ajax_upgrade' ) );
/**
 * Register the admin page.
 *
 * @see     Charitable_Upgrade_Page::register_page()
 */
add_action('admin_menu', array(Charitable_Upgrade_Page::get_instance(), 'register_page'));
/**
 * Hide the admin page from the menu.
 *
 * @see     Charitable_Upgrade_Page::remove_page_from_menu()
 */
add_action('admin_head', array(Charitable_Upgrade_Page::get_instance(), 'remove_page_from_menu'));
/**
 * Update the upgrade system. 
 *
 * @see     Charitable_Upgrade::update_upgrade_system()
 */
add_action('charitable_update_upgrade_system', array(Charitable_Upgrade::get_instance(), 'update_upgrade_system'));
/**
 * Run the upgrade for 1.3.0. 
 *
 * @see     Charitable_Upgrade::upgrade_1_3_0_fix_gmt_dates()
 */
add_action('charitable_fix_donation_dates', array(Charitable_Upgrade::get_instance(), 'fix_donation_dates'));
// add_action( 'admin_init', array( Charitable_Upgrade_Page::get_instance(), 'welcome'    ) );
 /**
  * Set up the upgrade log. 
  *
  * @return  void
  * @access  protected
  * @since   1.3.0
  */
 protected function setup_upgrade_log()
 {
     require_once 'admin/upgrades/class-charitable-upgrade.php';
     Charitable_Upgrade::get_instance()->populate_upgrade_log_on_install();
 }
Example #4
0
 /**
  * Perform upgrade routine if necessary. 
  *
  * @return  void
  * @access  private
  * @since   1.0.0
  */
 private function maybe_upgrade()
 {
     $db_version = get_option('charitable_version');
     if ($db_version !== self::VERSION) {
         require_once $this->get_path('includes') . 'class-charitable-upgrade.php';
         Charitable_Upgrade::upgrade_from($db_version, self::VERSION);
     }
 }