__FILE__ = $__FILE__; $config_file = plugin_dir_path( $this->__FILE__ ).'bsdk_config.json'; if(file_exists($config_file)){ $this->config = (object) wp_parse_args(json_decode(file_get_contents($config_file)), FS_LITE_CONFIG ); }else { $config_file = plugin_dir_path( $this->__FILE__ ).basename(__DIR__).'/config.json'; if(file_exists($config_file)){ $this->config = (object) wp_parse_args(json_decode(file_get_contents($config_file)), FS_LITE_CONFIG); }else { $this->config = (object) wp_parse_args($config, FS_LITE_CONFIG); } } $this->config = (object) wp_parse_args( $config, (array) $this->config ); $this->prefix = $this->config->prefix ?? ''; if(\is_admin()){ if($this->config->features->optIn){ new FSActivate($this->config, $__FILE__); } } $this->register(); } function register(){ add_action('plugins_loaded', [$this, 'i18n']); } function i18n(){ load_plugin_textdomain('bPlugins-sdk', false, plugin_dir_url( __FILE__ ) . '/languages/'); } public function can_use_premium_feature(){ return $this->is_premium(); } public function is_premium(){ return $this->lc->isPipe ?? false; } public function uninstall_plugin( ){ deactivate_plugins( plugin_basename( $this->__FILE__ ) ); } function can_use_premium_code(){ return $this->is_premium(); } function can_use_premium_code__premium_only(){ return $this->is_premium(); } function is__premium_only(){ return $this->is_premium(); } } } if(!function_exists('fs_lite_dynamic_init')){ function fs_lite_dynamic_init($module){ try { $caller = debug_backtrace(); if(isset($caller[0]['file'])){ $module['__FILE__'] = $caller[0]['file']; } if(!isset($module['__FILE__']) ){ throw new Error( "No __FILE__"); } if(dirname(plugin_basename( $module['__FILE__'] )) !== $module['slug'] && function_exists('fs_dynamic_init')){ return fs_dynamic_init($module); } $module['platform'] = 'freemius'; $fs = new BPluginsFSLite($module['__FILE__'], $module); return $fs; } catch (\Throwable $th) { echo $th->getMessage(); } } }