| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: WP Data Access |
| 4 |
* Plugin URI: https://wpdataaccess.com/ |
| 5 |
* Description: Local and remote data administration, publication and app development tool available directly from the WordPress dashboard. |
| 6 |
* Version: 3.1.3 |
| 7 |
* Author: Peter Schulz |
| 8 |
* Author URI: https://wpdataaccess.com/ |
| 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 |
const SETTINGS_URL = 'options-general.php?page=wpdataaccess'; |
| 24 |
const WEBSITE_URL = 'https://wpdataaccess.com/'; |
| 25 |
function wpda_row_meta( $links, $file ) { |
| 26 |
if ( strpos( $file, plugin_basename(__FILE__) ) !== false ) { |
| 27 |
// Add settings link |
| 28 |
$settings_url = esc_url( get_admin_url() . SETTINGS_URL ); |
| 29 |
$settings_link = "<a href='$settings_url'>Settings</a>"; |
| 30 |
array_push( $links, $settings_link ); |
| 31 |
|
| 32 |
// Add website link |
| 33 |
$website_url = esc_url( WEBSITE_URL ); |
| 34 |
$website_link = "<a href='$website_url'>Website</a>"; |
| 35 |
array_push( $links, $website_link ); |
| 36 |
} |
| 37 |
|
| 38 |
return $links; |
| 39 |
} |
| 40 |
add_filter( 'plugin_row_meta', 'wpda_row_meta', 10, 2 ); |
| 41 |
|
| 42 |
// Load WPDataAccess namespace. |
| 43 |
require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
| 44 |
|
| 45 |
/** |
| 46 |
* Activate plugin |
| 47 |
* |
| 48 |
* @author Peter Schulz |
| 49 |
* @since 1.0.0 |
| 50 |
*/ |
| 51 |
function activate_wp_data_access() { |
| 52 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access-switch.php'; |
| 53 |
WP_Data_Access_Switch::activate(); |
| 54 |
} |
| 55 |
register_activation_hook( __FILE__, 'activate_wp_data_access' ); |
| 56 |
|
| 57 |
/** |
| 58 |
* Deactivate plugin |
| 59 |
* |
| 60 |
* @author Peter Schulz |
| 61 |
* @since 1.0.0 |
| 62 |
*/ |
| 63 |
function deactivate_wp_data_access() { |
| 64 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access-switch.php'; |
| 65 |
WP_Data_Access_Switch::deactivate(); |
| 66 |
} |
| 67 |
register_deactivation_hook( __FILE__, 'deactivate_wp_data_access' ); |
| 68 |
|
| 69 |
/** |
| 70 |
* Check if database needs to be updated |
| 71 |
* |
| 72 |
* @author Peter Schulz |
| 73 |
* @since 1.5.2 |
| 74 |
*/ |
| 75 |
function wpda_update_db_check() { |
| 76 |
if ( WPDataAccess\WPDA::OPTION_WPDA_VERSION[1] !== get_option( WPDataAccess\WPDA::OPTION_WPDA_VERSION[0] ) ) { |
| 77 |
activate_wp_data_access(); |
| 78 |
} |
| 79 |
} |
| 80 |
add_action( 'plugins_loaded', 'wpda_update_db_check' ); |
| 81 |
|
| 82 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access.php'; |
| 83 |
/** |
| 84 |
* Start plugin |
| 85 |
* |
| 86 |
* @author Peter Schulz |
| 87 |
* @since 1.0.0 |
| 88 |
*/ |
| 89 |
function run_wp_data_access() { |
| 90 |
$wpdataaccess = new WP_Data_Access(); |
| 91 |
$wpdataaccess->run(); |
| 92 |
} |
| 93 |
run_wp_data_access(); |
| 94 |
|