'23407', 'slug' => 'accessibility-guard', 'type' => 'plugin', 'public_key' => 'pk_715012c3645fd8b406a8a92ef5730', 'is_premium' => false, 'premium_suffix' => 'Pro', 'has_premium_version' => true, 'has_addons' => false, 'has_paid_plans' => true, 'menu' => array( 'slug' => 'wpag-dashboard', 'support' => false, ), ) ); } return $ag_fs; } // Init Freemius. ag_fs(); // Signal that SDK was initiated. do_action( 'ag_fs_loaded' ); // Hook uninstall cleanup to Freemius. ag_fs()->add_action( 'after_uninstall', 'wpag_uninstall_cleanup' ); } /** * Check if Pro version is active. * * @return bool */ function wpag_is_pro() { return ag_fs()->is_paying(); } // Plugin constants. define( 'WPAG_VERSION', '1.0.0' ); define( 'WPAG_PLUGIN_FILE', __FILE__ ); define( 'WPAG_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'WPAG_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'WPAG_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); // Include class files. require_once WPAG_PLUGIN_DIR . 'includes/class-wpag-checks.php'; require_once WPAG_PLUGIN_DIR . 'includes/class-wpag-scanner.php'; require_once WPAG_PLUGIN_DIR . 'includes/class-wpag-admin.php'; require_once WPAG_PLUGIN_DIR . 'includes/class-wpag-ajax.php'; require_once WPAG_PLUGIN_DIR . 'includes/class-wpag-auto-fixer.php'; require_once WPAG_PLUGIN_DIR . 'includes/class-wpag-statement.php'; require_once WPAG_PLUGIN_DIR . 'includes/class-wpag-pro.php'; /** * Return default plugin settings. * * @return array */ function wpag_default_settings() { return array( 'auto_fix_skip_link' => true, 'auto_fix_lang_attr' => true, 'auto_fix_empty_headings' => false, 'auto_fix_form_labels' => false, 'statement_page_id' => 0, 'scan_post_types' => array( 'page', 'post' ), 'severity_filter' => 'all', 'statement_org_name' => '', 'statement_email' => '', 'statement_conformance' => 'AA', 'statement_limitations' => '', ); } /** * Initialize plugin classes. */ function wpag_init() { WPAG_Admin::instance(); WPAG_Ajax::instance(); WPAG_Auto_Fixer::instance(); WPAG_Statement::instance(); WPAG_Pro::instance(); } add_action( 'plugins_loaded', 'wpag_init' ); /** * Plugin activation. */ function wpag_activate() { add_option( 'wpag_settings', wpag_default_settings() ); add_option( 'wpag_version', WPAG_VERSION ); } register_activation_hook( __FILE__, 'wpag_activate' ); /** * Plugin deactivation. */ function wpag_deactivate() { global $wpdb; $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s", $wpdb->esc_like( '_transient_wpag_scan_' ) . '%', $wpdb->esc_like( '_transient_timeout_wpag_scan_' ) . '%' ) ); } register_deactivation_hook( __FILE__, 'wpag_deactivate' ); /** * Uninstall cleanup - hooked to Freemius after_uninstall action. * This runs when the plugin is deleted via WordPress admin. */ function wpag_uninstall_cleanup() { // Get settings BEFORE deleting (need statement_page_id). $wpag_settings = get_option( 'wpag_settings' ); // Delete the statement page if it exists. if ( is_array( $wpag_settings ) && ! empty( $wpag_settings['statement_page_id'] ) ) { wp_delete_post( absint( $wpag_settings['statement_page_id'] ), true ); } // Delete options. delete_option( 'wpag_settings' ); delete_option( 'wpag_version' ); delete_option( 'wpag_audit_history' ); delete_option( 'wpag_pdf_scan_results' ); delete_option( 'wpag_custom_rules' ); delete_option( 'wpag_scan_frequency' ); // Delete all post meta. global $wpdb; $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE %s", $wpdb->esc_like( '_wpag_' ) . '%' ) ); // Delete all transients. $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s", $wpdb->esc_like( '_transient_wpag_scan_' ) . '%', $wpdb->esc_like( '_transient_timeout_wpag_scan_' ) . '%' ) ); // Clear scheduled cron. wp_clear_scheduled_hook( 'wpag_scheduled_scan' ); }