PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 1.0.4
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v1.0.4
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
cartflows / classes / class-cartflows-bsf-updater.php

class-cartflows-bsf-updater.php in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce 1.0.4, at classes/class-cartflows-bsf-updater.php

111 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main builder BSF Updater class.
4 *
5 * @package cartflows
6 */
7
8 // Prohibit direct script loading.
9 defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
10 if ( ! class_exists( 'Cartflows_Bsf_Updater' ) ) {
11 /**
12 * Class Cartflows_Bsf_Updater.
13 */
14 class Cartflows_Bsf_Updater {
15
16 /**
17 * Constructor.
18 */
19 function __construct() {
20
21 $this->set_bsf_path();
22
23 add_filter( 'bsf_authors_list', array( $this, 'add_cartflows_author' ) );
24
25 add_action( 'init', array( $this, 'bsf_core_load' ), 999 );
26 add_filter( 'bsf_skip_braisntorm_menu', array( $this, 'skip_brainstorm_menu' ) );
27 add_filter( 'bsf_skip_author_registration', array( $this, 'skip_brainstorm_menu' ) );
28
29 // Disable license activation notice for cartflows.
30 add_filter( 'bsf_display_product_activation_notice_cartflows', '__return_false' );
31 }
32
33 /**
34 * Function Name: add_cartflows_author.
35 * Function Description: Adds cartflows author to get updates.
36 *
37 * @param array $authors authors array.
38 */
39 public function add_cartflows_author( $authors ) {
40
41 $authors[] = 'CartFlows Inc';
42 return $authors;
43 }
44
45 /**
46 * Function Name: set_bsf_path.
47 * Function Description: Set path.
48 */
49 public function set_bsf_path() {
50
51 $bsf_core_version_file = CARTFLOWS_DIR . 'admin/bsf-core/version.yml';
52
53 if ( is_file( $bsf_core_version_file ) ) {
54 global $bsf_core_version, $bsf_core_path;
55 $bsf_core_dir = CARTFLOWS_DIR . 'admin/bsf-core/';
56 $version = file_get_contents( $bsf_core_version_file );
57 if ( version_compare( $version, $bsf_core_version, '>' ) ) {
58 $bsf_core_version = $version;
59 $bsf_core_path = $bsf_core_dir;
60 }
61 }
62 }
63
64 /**
65 * Function Name: bsf_core_load.
66 * Function Description: Load Core.
67 */
68 public function bsf_core_load() {
69 global $bsf_core_version, $bsf_core_path;
70
71 if ( is_file( realpath( $bsf_core_path . '/index.php' ) ) ) {
72 include_once realpath( $bsf_core_path . '/index.php' );
73 }
74 }
75
76 /**
77 * Function Name: bsf_get_option.
78 * Function Description: Get options.
79 *
80 * @param Boolean $request true or false.
81 */
82 public function bsf_get_option( $request = false ) {
83 $bsf_options = get_option( 'bsf_options' );
84 if ( ! $request ) {
85 return $bsf_options;
86 } else {
87 return ( isset( $bsf_options[ $request ] ) ) ? $bsf_options[ $request ] : false;
88 }
89 }
90
91 /**
92 * Function Name: skip_brainstorm_menu.
93 * Function Description: skip_brainstorm_menu.
94 *
95 * @param string $products products.
96 */
97 public function skip_brainstorm_menu( $products ) {
98
99 $product_id = 'cartflows';
100 $products[] = $product_id;
101
102 return $products;
103 }
104
105 }
106 }
107
108 if ( class_exists( 'Cartflows_Bsf_Updater' ) ) {
109 new Cartflows_Bsf_Updater();
110 }
111