<?php
define( 'DB_RESET_VERSION5', '3.0.3' );
define( 'DB_RESET_PATH5', dirname( __FILE__ ) );
define( 'DB_RESET_NAME5', basename( DB_RESET_PATH5 ) );
define( 'AUTOLOADER5', DB_RESET_PATH5 . '/lib/class-plugin-autoloader.php' );

require_once( DB_RESET_PATH5 . '/lib/helpers.php' );

register_activation_hook( __FILE__, 'db_reset_activate5' );

// load_plugin_textdomain( 'wordpress-database-reset', false, DB_RESET_NAME5 . '/languages/' );

if ( file_exists( AUTOLOADER5 ) ) {
  require_once( AUTOLOADER5 );
  new Plugin_Autoloader( DB_RESET_PATH5 );

  add_action(
    'wp_loaded',
    array ( new DB_Reset_Manager( DB_RESET_VERSION5 ), 'run' )
  );
}



    function wpfresh5_instareset() {
        global $wpdb;
        $wp_tables = $wpdb->tables();
?>
  <form method="post" id="db-reset-form" CLASS="form">
    <p>InstaReset will completely reset up your WordPress site database tables to their original state.</p>

<p>This means all your data will be wiped out. Among all the users, just the admin user will remain.</p>

<p>Themes and plugins will remain but will be marked inactive, to customize settings use the Advanced option. </p>
    <a class="button button-secondary" id="wpfs5-more-instareset" role="button" data-toggle="collapse" href="#" aria-expanded="false" aria-controls="advanced_instareset">
      <i class="fa fa-cog"></i> Advanced
    </a>
<br/>
<br/>
    <div id="advanced_instareset" style="display:none">
<h4><?php _e( 'Select the database tables you would like to reset', 'wordpress-database-reset' ) ?>:</h4>

<div id="select-container">
  <a href='#' id="select-all"><?php _e( 'Select All', 'wordpress-database-reset' ) ?></a>
  <select id="wp-tables" multiple="multiple" name="db-reset-tables[]">
    <?php foreach ( $wp_tables as $key => $value ) : ?>
      <option value="<?php echo $key ?>" selected="selected"><?php echo $key ?></option>
    <?php endforeach ?>
  </select>
</div>

<p id="reactivate">
  <label for="db-reset-reactivate-theme-data">
    <input type="checkbox" name="db-reset-reactivate-theme-data" id="db-reset-reactivate-theme-data" value="true" />
    <?php _e( 'Reactivate current theme and plugins after reset?', 'wordpress-database-reset' ) ?>
  </label>
</p>
</div>
<p>
    <h4>Write "CONFIRM" here:</h4>
    <input type="text" name="db-reset-code-confirm" id="db-reset-code-confirm">
</p>
<p>
  <!-- <input type="submit" name="db-reset-submit" value="<?php _e( 'Reset Tables', 'wordpress-database-reset' ) ?>" id="db-reset-submit" class='click-start-submit' disabled /> -->
  <button type="submit" name="db-reset-submit" value="<?php _e( 'Reset Tables', 'wordpress-database-reset' ) ?>" id="db-reset-submit" class='button button-primary' disabled /><i class="fa fa-check"></i> Run!</button>
  
  <img src="<?php echo WPFRESH5_URL.'/lib/instareset/assets/images/spinner.gif'; ?>" alt="loader" id="loader" style="display: none" />

<br/>
<br/>
  <div class="notice notice-warning inline"><p> <i class="fa fa-warning"></i> <b>WARNING!</b> By clicking "Run" button, all data from the database will be deleted. We recommend doing a full database backup first so you can recover if something goes wrong.</div>

</p>
</form>
<?php
    }


?>