PointOfSaleDefaultSettings.php
63 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Default settings for Point of Sale. |
| 4 | * |
| 5 | * @package WooCommerce\Internal\Settings |
| 6 | */ |
| 7 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | namespace Automattic\WooCommerce\Internal\Settings; |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; // Exit if accessed directly. |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * PointOfSaleDefaultSettings class. |
| 18 | */ |
| 19 | class PointOfSaleDefaultSettings { |
| 20 | /** |
| 21 | * Get default store email. |
| 22 | * |
| 23 | * @return string |
| 24 | */ |
| 25 | public static function get_default_store_email() { |
| 26 | return get_option( 'admin_email' ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Get default store name. |
| 31 | * |
| 32 | * @return string |
| 33 | */ |
| 34 | public static function get_default_store_name() { |
| 35 | return get_bloginfo( 'name' ); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Get default store address. |
| 40 | * |
| 41 | * @return string |
| 42 | */ |
| 43 | public static function get_default_store_address() { |
| 44 | if ( ! WC() || ! WC()->countries ) { |
| 45 | return ''; |
| 46 | } |
| 47 | |
| 48 | return wp_specialchars_decode( |
| 49 | WC()->countries->get_formatted_address( |
| 50 | array( |
| 51 | 'address_1' => WC()->countries->get_base_address(), |
| 52 | 'address_2' => WC()->countries->get_base_address_2(), |
| 53 | 'city' => WC()->countries->get_base_city(), |
| 54 | 'state' => WC()->countries->get_base_state(), |
| 55 | 'postcode' => WC()->countries->get_base_postcode(), |
| 56 | 'country' => WC()->countries->get_base_country(), |
| 57 | ), |
| 58 | "\n" |
| 59 | ) |
| 60 | ); |
| 61 | } |
| 62 | } |
| 63 |