PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.6.5
ShopBuilder – WooCommerce Builder For Elementor v2.6.5
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 / Modules / WishList / WishlistInstaller.php

WishlistInstaller.php in ShopBuilder – WooCommerce Builder For Elementor 2.6.5, at app/Modules/WishList/WishlistInstaller.php

66 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace RadiusTheme\SB\Modules\WishList;
4
5 use RadiusTheme\SB\Helpers\Fns;
6
7 // Do not allow directly accessing this file.
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit( 'This script cannot be accessed directly.' );
10 }
11
12 class WishlistInstaller {
13
14 /**
15 * Run the installer
16 *
17 * @return void
18 */
19 public function run() {
20 $this->create_page();
21 }
22
23 /**
24 * [create_page] Create page
25 *
26 * @return void [void]
27 */
28 private function create_page() {
29
30 $page_id = Fns::get_option( 'modules', 'wishlist', 'page', 0, 'number' );
31 if ( $page_id > 0 ) {
32 $page_object = get_post( $page_id );
33
34 if ( $page_object && 'page' === $page_object->post_type && ! in_array(
35 $page_object->post_status,
36 [
37 'pending',
38 'trash',
39 'future',
40 'auto-draft',
41 ],
42 true
43 ) ) {
44 // Valid page is already in place.
45 return;
46 }
47 }
48 if ( function_exists( 'WC' ) ) {
49 if ( ! function_exists( 'wc_create_page' ) ) {
50 require_once WC_ABSPATH . '/includes/admin/wc-admin-functions.php';
51 }
52 $create_page_id = wc_create_page(
53 sanitize_title_with_dashes( _x( 'wishlist', 'page_slug', 'shopbuilder' ) ),
54 '',
55 esc_html__( 'Wishlist', 'shopbuilder' ),
56 '<!-- wp:shortcode -->[rtsb_wishlist]<!-- /wp:shortcode -->'
57 );
58 if ( $create_page_id ) {
59 $section_items = [];
60 $section_items['page'] = strval( $create_page_id );
61 Fns::set_options( 'modules', 'wishlist', $section_items );
62 }
63 }
64 }
65 }
66