PluginProbe
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code / 5.2.0
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code v5.2.0
5.5.3 3.1.0 3.2.0 3.2.1 3.3.0 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.6.0 3.7.0 3.8.0 3.8.1 3.8.2 3.8.3 4.0.0 4.0.2 4.0.3 4.0.4 4.0.5 4.1.0 4.1.1 All 78 releases
copy-the-code / includes / freemius.php

freemius.php in Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code 5.2.0, at includes/freemius.php

90 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 /**
4 * Freemius helper.
5 *
6 * @package CTC
7 */
8 if ( function_exists( 'ctc_fs' ) ) {
9 return;
10 }
11 /**
12 * Create a helper function for easy SDK access.
13 *
14 * @return object|null Freemius SDK instance, or null if not yet initialized.
15 */
16 function ctc_fs() {
17 global $ctc_fs;
18 // Return existing instance if already initialized.
19 if ( isset( $ctc_fs ) ) {
20 return $ctc_fs;
21 }
22 // Don't initialize before plugins_loaded to avoid early translation loading (WP 6.7+).
23 if ( !did_action( 'plugins_loaded' ) ) {
24 return null;
25 }
26 // Include Freemius SDK from Composer vendor directory.
27 $freemius_sdk_path = dirname( __DIR__ ) . '/vendor/freemius/wordpress-sdk/start.php';
28 if ( !file_exists( $freemius_sdk_path ) ) {
29 wp_die( 'Freemius SDK not found. Please run: composer install' );
30 }
31 require_once $freemius_sdk_path;
32 $ctc_fs = fs_dynamic_init( [
33 'id' => '2780',
34 'slug' => 'ctc',
35 'type' => 'plugin',
36 'public_key' => 'pk_15a174f8c30f506a9a35ccbf0fa76',
37 'is_premium' => false,
38 'premium_suffix' => 'Premium',
39 'has_addons' => false,
40 'has_paid_plans' => true,
41 'has_affiliation' => 'selected',
42 'menu' => [
43 'slug' => 'ctc-global-injector',
44 'override_exact' => true,
45 'first-path' => 'options-general.php?page=ctc-global-injector',
46 'contact' => true,
47 'support' => true,
48 'affiliation' => false,
49 'parent' => [
50 'slug' => 'options-general.php',
51 ],
52 ],
53 'is_live' => true,
54 ] );
55 // Signal that SDK was initiated.
56 do_action( 'ctc/freemius/loaded' );
57 return $ctc_fs;
58 }
59
60 /**
61 * Initialize Freemius SDK and add filters.
62 *
63 * Called on plugins_loaded to avoid early translation loading issues.
64 */
65 function ctc_fs_init() {
66 $fs = ctc_fs();
67 if ( !$fs ) {
68 return;
69 }
70 // @phpstan-ignore-next-line
71 $fs->add_filter( 'connect_url', 'ctc_fs_settings_url' );
72 // @phpstan-ignore-next-line
73 $fs->add_filter( 'after_skip_url', 'ctc_fs_settings_url' );
74 // @phpstan-ignore-next-line
75 $fs->add_filter( 'after_connect_url', 'ctc_fs_settings_url' );
76 // @phpstan-ignore-next-line
77 $fs->add_filter( 'after_pending_connect_url', 'ctc_fs_settings_url' );
78 }
79
80 /**
81 * Get the settings URL.
82 *
83 * @return string
84 */
85 function ctc_fs_settings_url() {
86 return admin_url( 'options-general.php?page=ctc-global-injector' );
87 }
88
89 // Initialize Freemius on plugins_loaded (after textdomain is loaded).
90 add_action( 'plugins_loaded', 'ctc_fs_init', 10 );