| 1 |
<?php |
| 2 |
|
| 3 |
namespace DebugLogViewer\Admin\Controllers; |
| 4 |
|
| 5 |
if ( !defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
// Exit if accessed directly. |
| 8 |
} |
| 9 |
class FreemiusController { |
| 10 |
public function init() { |
| 11 |
if ( !function_exists( 'dbg_lv' ) ) { |
| 12 |
function dbg_lv() { |
| 13 |
global $dbg_lv; |
| 14 |
if ( isset( $dbg_lv ) ) { |
| 15 |
return $dbg_lv; |
| 16 |
} |
| 17 |
FreemiusController::include_sdk(); |
| 18 |
$dbg_lv = fs_dynamic_init( [ |
| 19 |
'id' => '17350', |
| 20 |
'slug' => 'debug-log-viewer', |
| 21 |
'type' => 'plugin', |
| 22 |
'public_key' => 'pk_d456c712f16510d920c9f4ba4880a', |
| 23 |
'is_premium' => false, |
| 24 |
'has_addons' => false, |
| 25 |
'has_paid_plans' => true, |
| 26 |
'menu' => [ |
| 27 |
'slug' => 'debug-log-viewer', |
| 28 |
'first-path' => 'admin.php?page=debug-log-viewer', |
| 29 |
], |
| 30 |
'is_live' => true, |
| 31 |
'is_org_compliant' => true, |
| 32 |
] ); |
| 33 |
return $dbg_lv; |
| 34 |
} |
| 35 |
|
| 36 |
// Initialize Freemius. |
| 37 |
dbg_lv(); |
| 38 |
// Signal that the SDK was initiated. |
| 39 |
do_action( 'dbg_lv_loaded' ); |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
public static function include_sdk() { |
| 44 |
$freemius_path = __DIR__ . '/../../vendor/freemius/wordpress-sdk/start.php'; |
| 45 |
if ( file_exists( $freemius_path ) ) { |
| 46 |
require_once $freemius_path; |
| 47 |
} else { |
| 48 |
$fallback_path = __DIR__ . '/../../freemius/wordpress-sdk/start.php'; |
| 49 |
if ( file_exists( $fallback_path ) ) { |
| 50 |
require_once $fallback_path; |
| 51 |
} else { |
| 52 |
// Handle the error if neither path exists. |
| 53 |
wp_die( 'Freemius SDK not found. Please check the installation.' ); |
| 54 |
} |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
} |
| 59 |
|