PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.1
ShopBuilder – WooCommerce Builder For Elementor v3.2.1
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Controllers / PluginsSupport / WooAddressBook.php

WooAddressBook.php in ShopBuilder – WooCommerce Builder For Elementor 3.2.1, at app/Controllers/PluginsSupport/WooAddressBook.php

64 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WooCommerce address book plugin support.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Controllers\PluginsSupport;
9
10 use RadiusTheme\SB\Traits\SingletonTrait;
11
12 // Do not allow directly accessing this file.
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit( 'This script cannot be accessed directly.' );
15 }
16
17 /**
18 * WooCommerce address book plugin support
19 */
20 class WooAddressBook {
21 /**
22 * SingletonTrait.
23 */
24 use SingletonTrait;
25
26 /**
27 * Construct function
28 */
29 private function __construct() {
30 add_filter( 'woocommerce_edit_address_slugs', [ $this, 'change_slug' ], 99 );
31 add_shortcode( 'rtsb_woo_address_book', [ $this, 'woo_address_book' ] );
32 }
33
34 /**
35 * Address book shortcode.
36 *
37 * @return string
38 */
39 public function woo_address_book() {
40 ob_start();
41
42 $address = \WC_Address_Book::get_instance();
43 $address->wc_address_book_page( '' );
44
45 return ob_get_clean();
46 }
47
48 /**
49 * Change endpoint slug.
50 *
51 * @param array $slugs Page slug.
52 *
53 * @return array
54 */
55 public function change_slug( $slugs ) {
56 $the_slug = [];
57 foreach ( $slugs as $key => $value ) {
58 $the_slug[ $key ] = $key;
59 }
60
61 return $the_slug;
62 }
63 }
64