PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 1.1.4
ShopBuilder – WooCommerce Builder For Elementor v1.1.4
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
← All changes | app/Modules/Compare/CompareInstaller.php +63 -67 2.2.21.1.4 View file →
@@ -1,67 +1,63 @@
1 -<?php
2 -
3 -namespace RadiusTheme\SB\Modules\Compare;
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 -
13 -class CompareInstaller {
14 -
15 - /**
16 - * Run the installer
17 - *
18 - * @return void
19 - */
20 - public function run() {
21 - $this->create_page();
22 - }
23 -
24 - /**
25 - * [create_page] Create page
26 - *
27 - * @return void [void]
28 - */
29 - private function create_page() {
30 -
31 - $page_id = Fns::get_option( 'modules', 'compare', 'page', 0, 'number' );
32 - if ( $page_id > 0 ) {
33 - $page_object = get_post( $page_id );
34 -
35 - if ( $page_object && 'page' === $page_object->post_type && ! in_array(
36 - $page_object->post_status,
37 - [
38 - 'pending',
39 - 'trash',
40 - 'future',
41 - 'auto-draft',
42 - ],
43 - true
44 - ) ) {
45 - // Valid page is already in place.
46 - return;
47 - }
48 - }
49 - if ( function_exists( 'WC' ) ) {
50 - if ( ! function_exists( 'wc_create_page' ) ) {
51 - require_once WC_ABSPATH . '/includes/admin/wc-admin-functions.php';
52 - }
53 - $create_page_id = wc_create_page(
54 - sanitize_title_with_dashes( _x( 'compare', 'page_slug', 'shopbuilder' ) ),
55 - '',
56 - esc_html__( 'Compare', 'shopbuilder' ),
57 - '<!-- wp:shortcode -->[rtsb_compare_list]<!-- /wp:shortcode -->'
58 - );
59 - if ( $create_page_id ) {
60 - $section_items = [];
61 - $section_items['page'] = strval( $create_page_id );
62 - Fns::set_options( 'modules', 'compare', $section_items );
63 -
64 - }
65 - }
66 - }
67 -}
1 +<?php
2 +
3 +namespace RadiusTheme\SB\Modules\Compare;
4 +
5 +use RadiusTheme\SB\Helpers\Fns;
6 +use RadiusTheme\SB\Models\DataModel;
7 +
8 +// Do not allow directly accessing this file.
9 +if ( ! defined( 'ABSPATH' ) ) {
10 + exit( 'This script cannot be accessed directly.' );
11 +}
12 +
13 +
14 +class CompareInstaller {
15 +
16 + /**
17 + * Run the installer
18 + *
19 + * @return void
20 + */
21 + public function run() {
22 + $this->create_page();
23 + }
24 +
25 + /**
26 + * [create_page] Create page
27 + *
28 + * @return void [void]
29 + */
30 + private function create_page() {
31 +
32 + $page_id = Fns::get_option( 'modules', 'compare', 'page', 0, 'number' );
33 + if ( $page_id > 0 ) {
34 + $page_object = get_post( $page_id );
35 +
36 + if ( $page_object && 'page' === $page_object->post_type && ! in_array( $page_object->post_status, [
37 + 'pending',
38 + 'trash',
39 + 'future',
40 + 'auto-draft'
41 + ], true ) ) {
42 + // Valid page is already in place.
43 + return;
44 + }
45 + }
46 + if ( function_exists( 'WC' ) ) {
47 + if ( ! function_exists( 'wc_create_page' ) ) {
48 + require_once WC_ABSPATH . '/includes/admin/wc-admin-functions.php';
49 + }
50 + $create_page_id = wc_create_page(
51 + sanitize_title_with_dashes( _x( 'compare', 'page_slug', 'shopbuilder' ) ),
52 + '',
53 + esc_html__( 'Compare', 'shopbuilder' ),
54 + '<!-- wp:shortcode -->[rtsb_compare_list]<!-- /wp:shortcode -->'
55 + );
56 + if ( $create_page_id ) {
57 + $section_items = DataModel::source()->get_option( 'modules', [] );
58 + $section_items['compare']['page'] = $create_page_id;
59 + DataModel::source()->set_option( 'modules', $section_items );
60 + }
61 + }
62 + }
63 +}