PluginProbe
Countdown Timer Block – build urgency for events and launches / 1.2.1
Countdown Timer Block – build urgency for events and launches v1.2.1
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.1, at bplugins_sdk/init.php

104 lines 3.4 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 LLC.
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 = '1.1.2';
10
11 if ( !class_exists( 'BPluginsFSLite' ) ) {
12 // require all elements
13 require_once dirname( __FILE__ ) . '/require.php';
14 class BPluginsFSLite
15 {
16 protected $file = null ;
17 public $prefix = '' ;
18 protected $config = array() ;
19 protected $__FILE__ = __FILE__ ;
20 private $lc = null ;
21 function __construct( $__FILE__, $config = array() )
22 {
23 $this->__FILE__ = $__FILE__;
24 $config_file = plugin_dir_path( $this->__FILE__ ) . 'bsdk_config.json';
25
26 if ( file_exists( $config_file ) ) {
27 $this->config = (object) wp_parse_args( json_decode( file_get_contents( $config_file ) ), FS_LITE_CONFIG );
28 } else {
29 $config_file = plugin_dir_path( $this->__FILE__ ) . basename( __DIR__ ) . '/config.json';
30
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 }
38
39 $this->config = (object) wp_parse_args( $config, (array) $this->config );
40 $this->prefix = $this->config->prefix ?? '';
41 if ( \is_admin() ) {
42 if ( $this->config->features->optIn ) {
43 new FSActivate( $this->config, $__FILE__ );
44 }
45 }
46 $this->register();
47 }
48
49 function register()
50 {
51 add_action( 'plugins_loaded', [ $this, 'i18n' ] );
52 }
53
54 function i18n()
55 {
56 load_plugin_textdomain( 'bPlugins-sdk', false, plugin_dir_url( __FILE__ ) . '/languages/' );
57 }
58
59 public function can_use_premium_feature()
60 {
61 return $this->is_premium();
62 }
63
64 public function is_premium()
65 {
66 return $this->lc->isPipe ?? false;
67 }
68
69 public function uninstall_plugin()
70 {
71 deactivate_plugins( plugin_basename( $this->__FILE__ ) );
72 }
73
74 function can_use_premium_code()
75 {
76 return $this->is_premium();
77 }
78
79 }
80 }
81
82 if ( !function_exists( 'fs_lite_dynamic_init' ) ) {
83 function fs_lite_dynamic_init( $module )
84 {
85 try {
86 $caller = debug_backtrace();
87 if ( isset( $caller[0]['file'] ) ) {
88 $module['__FILE__'] = $caller[0]['file'];
89 }
90 if ( !isset( $module['__FILE__'] ) ) {
91 throw new Error( "No __FILE__" );
92 }
93 if ( dirname( plugin_basename( $module['__FILE__'] ) ) !== $module['slug'] && function_exists( 'fs_dynamic_init' ) ) {
94 return fs_dynamic_init( $module );
95 }
96 $module['platform'] = 'freemius';
97 $fs = new BPluginsFSLite( $module['__FILE__'], $module );
98 return $fs;
99 } catch ( \Throwable $th ) {
100 echo $th->getMessage() ;
101 }
102 }
103
104 }