ConnectionHelper.php
30 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Helpers for managing connection to WooCommerce.com. |
| 4 | */ |
| 5 | |
| 6 | namespace Automattic\WooCommerce\Internal\WCCom; |
| 7 | |
| 8 | defined( 'ABSPATH' ) || exit; |
| 9 | |
| 10 | /** |
| 11 | * Class WCConnectionHelper. |
| 12 | * |
| 13 | * Helpers for managing connection to WooCommerce.com. |
| 14 | */ |
| 15 | final class ConnectionHelper { |
| 16 | /** |
| 17 | * Check if WooCommerce.com account is connected. |
| 18 | * |
| 19 | * @since 4.4.0 |
| 20 | * @return bool Whether account is connected. |
| 21 | */ |
| 22 | public static function is_connected() { |
| 23 | $helper_options = get_option( 'woocommerce_helper_data', array() ); |
| 24 | if ( is_array( $helper_options ) && array_key_exists( 'auth', $helper_options ) && ! empty( $helper_options['auth'] ) ) { |
| 25 | return true; |
| 26 | } |
| 27 | return false; |
| 28 | } |
| 29 | } |
| 30 |