PluginProbe
Countdown Timer Block – build urgency for events and launches / 1.2.8
Countdown Timer Block – build urgency for events and launches v1.2.8
1.3.3 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 All 32 releases
countdown-time / bplugins_sdk / init.php

init.php in Countdown Timer Block – build urgency for events and launches 1.2.8, at bplugins_sdk/init.php

105 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * @package bPlugins
5 * @copyright Copyright (c) 2015, bPlugins.
6 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
7 * @since 1.0.0
8 */
9 $this_sdk_version = '2.1.0';
10 if ( !class_exists( 'BPluginsFSLite' ) ) {
11 // require all elements
12 require_once dirname( __FILE__ ) . '/require.php';
13 class BPluginsFSLite {
14 protected $file = null;
15
16 public $prefix = '';
17
18 protected $config = null;
19
20 protected $__FILE__ = __FILE__;
21
22 private $lc = null;
23
24 function __construct( $__FILE__, $config = [] ) {
25 $this->__FILE__ = $__FILE__;
26 $config_file = plugin_dir_path( $this->__FILE__ ) . 'bsdk_config.json';
27 if ( file_exists( $config_file ) ) {
28 $this->config = (object) wp_parse_args( json_decode( file_get_contents( $config_file ) ), FS_LITE_CONFIG );
29 } else {
30 $config_file = plugin_dir_path( $this->__FILE__ ) . basename( __DIR__ ) . '/config.json';
31 if ( file_exists( $config_file ) ) {
32 $this->config = (object) wp_parse_args( json_decode( file_get_contents( $config_file ) ), FS_LITE_CONFIG );
33 } else {
34 $this->config = (object) wp_parse_args( $config, FS_LITE_CONFIG );
35 }
36 }
37 $this->config = (object) wp_parse_args( $config, (array) $this->config );
38 $this->prefix = $this->config->prefix ?? '';
39 if ( \is_admin() ) {
40 if ( $this->config->features->optIn ) {
41 new FSActivate($this->config, $__FILE__);
42 }
43 }
44 $this->register();
45 }
46
47 function register() {
48 add_action( 'plugins_loaded', [$this, 'i18n'] );
49 }
50
51 function i18n() {
52 load_plugin_textdomain( 'bPlugins-sdk', false, plugin_dir_url( __FILE__ ) . '/languages/' );
53 }
54
55 public function can_use_premium_feature() {
56 return $this->is_premium();
57 }
58
59 public function is_premium() {
60 return $this->lc->isPipe ?? false;
61 }
62
63 public function uninstall_plugin() {
64 deactivate_plugins( plugin_basename( $this->__FILE__ ) );
65 }
66
67 function can_use_premium_code() {
68 return $this->is_premium();
69 }
70
71 function set_basename( $uninstall, $__FILE__ ) {
72 $basename = basename( $__FILE__ );
73 if ( is_plugin_active( $this->config->slug . '/' . $basename ) ) {
74 deactivate_plugins( $this->config->slug . '/' . $basename );
75 }
76 if ( is_plugin_active( $this->config->slug . '-pro/' . $basename ) ) {
77 deactivate_plugins( $this->config->slug . '-pro/' . $basename );
78 }
79 }
80
81 }
82
83 }
84 if ( !function_exists( 'fs_lite_dynamic_init' ) ) {
85 function fs_lite_dynamic_init( $module ) {
86 try {
87 $caller = debug_backtrace();
88 if ( isset( $caller[0]['file'] ) ) {
89 $module['__FILE__'] = $caller[0]['file'];
90 }
91 if ( !isset( $module['__FILE__'] ) ) {
92 throw new Error("No __FILE__");
93 }
94 if ( dirname( plugin_basename( $module['__FILE__'] ) ) !== $module['slug'] && function_exists( 'fs_dynamic_init' ) ) {
95 return fs_dynamic_init( $module );
96 }
97 $module['platform'] = 'freemius';
98 $fs = new BPluginsFSLite($module['__FILE__'], $module);
99 return $fs;
100 } catch ( \Throwable $th ) {
101 throw $th->getMessage();
102 }
103 }
104
105 }