| @@ -2,9 +2,8 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace RadiusTheme\SB\Modules\Compare; |
| 4 | 4 | |
| 5 | 5 | use RadiusTheme\SB\Helpers\Fns; |
| 6 | -use RadiusTheme\SB\Models\DataModel; | |
| 7 | 6 | |
| 8 | 7 | // Do not allow directly accessing this file. |
| 9 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | 9 | exit( 'This script cannot be accessed directly.' ); |
| @@ -32,14 +31,18 @@ | ||
| 32 | 31 | $page_id = Fns::get_option( 'modules', 'compare', 'page', 0, 'number' ); |
| 33 | 32 | if ( $page_id > 0 ) { |
| 34 | 33 | $page_object = get_post( $page_id ); |
| 35 | 34 | |
| 36 | - if ( $page_object && 'page' === $page_object->post_type && ! in_array( $page_object->post_status, [ | |
| 35 | + if ( $page_object && 'page' === $page_object->post_type && ! in_array( | |
| 36 | + $page_object->post_status, | |
| 37 | + [ | |
| 37 | 38 | 'pending', |
| 38 | 39 | 'trash', |
| 39 | 40 | 'future', |
| 40 | - 'auto-draft' | |
| 41 | - ], true ) ) { | |
| 41 | + 'auto-draft', | |
| 42 | + ], | |
| 43 | + true | |
| 44 | + ) ) { | |
| 42 | 45 | // Valid page is already in place. |
| 43 | 46 | return; |
| 44 | 47 | } |
| 45 | 48 | } |
| @@ -53,11 +56,12 @@ | ||
| 53 | 56 | esc_html__( 'Compare', 'shopbuilder' ), |
| 54 | 57 | '<!-- wp:shortcode -->[rtsb_compare_list]<!-- /wp:shortcode -->' |
| 55 | 58 | ); |
| 56 | 59 | if ( $create_page_id ) { |
| 57 | - $section_items = DataModel::source()->get_option( 'modules', [] ); | |
| 58 | - $section_items['compare']['page'] = strval( $create_page_id ); | |
| 59 | - DataModel::source()->set_option( 'modules', $section_items ); | |
| 60 | + $section_items = []; | |
| 61 | + $section_items['page'] = strval( $create_page_id ); | |
| 62 | + Fns::set_options( 'modules', 'compare', $section_items ); | |
| 63 | + | |
| 60 | 64 | } |
| 61 | 65 | } |
| 62 | 66 | } |
| 63 | -} | |
| 67 | +} | |