id, array( 'plugins', 'plugins-network' ), true ) || ! current_user_can( 'activate_plugins' ) ) { return; } $woocommerce = 'woocommerce/woocommerce.php'; $installed = file_exists( WP_PLUGIN_DIR . '/' . $woocommerce ); $button = ''; $url = ''; if ( $installed ) { $message = __( 'Brickmoat is switched on, but WooCommerce is not active on this site, so there is no checkout to protect yet. Activate WooCommerce and Brickmoat starts working by itself.', 'brickmoat' ); if ( current_user_can( 'activate_plugin', $woocommerce ) ) { $button = __( 'Activate WooCommerce', 'brickmoat' ); $url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . rawurlencode( $woocommerce ) ), 'activate-plugin_' . $woocommerce ); } } else { $message = __( 'Brickmoat is switched on, but WooCommerce is not installed on this site, so there is no checkout to protect yet. Install and activate WooCommerce and Brickmoat starts working by itself.', 'brickmoat' ); if ( current_user_can( 'install_plugins' ) ) { $button = __( 'Install WooCommerce', 'brickmoat' ); $path = 'update.php?action=install-plugin&plugin=woocommerce'; $url = wp_nonce_url( is_multisite() ? network_admin_url( $path ) : admin_url( $path ), 'install-plugin_woocommerce' ); } } echo '
' . esc_html__( 'Brickmoat needs WooCommerce.', 'brickmoat' ) . ' ' . esc_html( $message ) . '
'; if ( '' !== $url ) { echo ''; } echo '