| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: WP Data Access |
| 4 |
* Plugin URI: https://wpdataaccess.com/ |
| 5 |
* Description: WP Data Access helps you to manage your WordPress data and database from the WordPress dashboard and to publish table data on your website. |
| 6 |
* Version: 2.7.0 |
| 7 |
* Author: Peter Schulz |
| 8 |
* Author URI: https://www.linkedin.com/in/peterschulznl/ |
| 9 |
* Text Domain: wp-data-access |
| 10 |
* License: GPL-2.0+ |
| 11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 12 |
* Domain Path: /languages |
| 13 |
* |
| 14 |
* @package plugin |
| 15 |
* @author Peter Schulz |
| 16 |
* @since 1.0.0 |
| 17 |
*/ |
| 18 |
|
| 19 |
if ( ! defined( 'WPINC' ) ) { |
| 20 |
die; |
| 21 |
} |
| 22 |
|
| 23 |
// Load WPDataAccess namespace. |
| 24 |
require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
| 25 |
|
| 26 |
/** |
| 27 |
* Activate plugin |
| 28 |
* |
| 29 |
* @author Peter Schulz |
| 30 |
* @since 1.0.0 |
| 31 |
*/ |
| 32 |
function activate_wp_data_access() { |
| 33 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access-switch.php'; |
| 34 |
WP_Data_Access_Switch::activate(); |
| 35 |
} |
| 36 |
|
| 37 |
register_activation_hook( __FILE__, 'activate_wp_data_access' ); |
| 38 |
|
| 39 |
/** |
| 40 |
* Deactivate plugin |
| 41 |
* |
| 42 |
* @author Peter Schulz |
| 43 |
* @since 1.0.0 |
| 44 |
*/ |
| 45 |
function deactivate_wp_data_access() { |
| 46 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access-switch.php'; |
| 47 |
WP_Data_Access_Switch::deactivate(); |
| 48 |
} |
| 49 |
|
| 50 |
register_deactivation_hook( __FILE__, 'deactivate_wp_data_access' ); |
| 51 |
|
| 52 |
/** |
| 53 |
* Check if database needs to be updated |
| 54 |
* |
| 55 |
* @author Peter Schulz |
| 56 |
* @since 1.5.2 |
| 57 |
*/ |
| 58 |
function wpda_update_db_check() { |
| 59 |
if ( WPDataAccess\WPDA::OPTION_WPDA_VERSION[1] !== get_option( WPDataAccess\WPDA::OPTION_WPDA_VERSION[0] ) ) { |
| 60 |
activate_wp_data_access(); |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
add_action( 'plugins_loaded', 'wpda_update_db_check' ); |
| 65 |
|
| 66 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access.php'; |
| 67 |
/** |
| 68 |
* Start plugin |
| 69 |
* |
| 70 |
* @author Peter Schulz |
| 71 |
* @since 1.0.0 |
| 72 |
*/ |
| 73 |
function run_wp_data_access() { |
| 74 |
$wpdataaccess = new WP_Data_Access(); |
| 75 |
$wpdataaccess->run(); |
| 76 |
} |
| 77 |
|
| 78 |
run_wp_data_access(); |
| 79 |
|