Skip to content

Commit cafccad

Browse files
committed
Renamed plugin to FreemKit
1 parent 75b9ab4 commit cafccad

44 files changed

Lines changed: 622 additions & 681 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.windsurf/plans/glue-link-kit-oauth.md

Lines changed: 0 additions & 59 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# glue-link
2-
Glue for Freemius and Kit
1+
# freemkit
2+
FreemKit

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "webberzone/glue-link",
3-
"description": "Glue for Freemius and Kit",
2+
"name": "webberzone/freemkit",
3+
"description": "FreemKit",
44
"type": "wordpress-plugin",
55
"keywords": [
66
"wordpress",

freemkit.php

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<?php
2+
/**
3+
* Plugin integration between Freemius and Kit
4+
*
5+
* @package WebberZone\FreemKit
6+
* @author WebberZone
7+
* @license GPL-2.0+
8+
* @link https://webberzone.com
9+
*
10+
* @wordpress-plugin
11+
* Plugin Name: WebberZone FreemKit - Glue for Freemius and Kit
12+
* Plugin URI: https://webberzone.com/plugins/freemkit/
13+
* Description: Easily subscribe Freemius customers to Kit email lists.
14+
* Version: 1.0.0-beta1
15+
* Author: WebberZone
16+
* Author URI: https://webberzone.com
17+
* License: GPL-2.0+
18+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
19+
* Text Domain: freemkit
20+
* Domain Path: /languages
21+
*/
22+
23+
namespace WebberZone\FreemKit;
24+
25+
if ( ! defined( 'WPINC' ) ) {
26+
die;
27+
}
28+
29+
// Define plugin constants.
30+
if ( ! defined( 'FREEMKIT_VERSION' ) ) {
31+
define( 'FREEMKIT_VERSION', '1.0.0' );
32+
}
33+
if ( ! defined( 'FREEMKIT_PLUGIN_FILE' ) ) {
34+
define( 'FREEMKIT_PLUGIN_FILE', __FILE__ );
35+
}
36+
if ( ! defined( 'FREEMKIT_PLUGIN_DIR' ) ) {
37+
define( 'FREEMKIT_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
38+
}
39+
40+
if ( ! defined( 'FREEMKIT_PLUGIN_URL' ) ) {
41+
define( 'FREEMKIT_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
42+
}
43+
44+
// Kit OAuth defaults (same OAuth application used by the official Kit WordPress flow).
45+
if ( ! defined( 'FREEMKIT_KIT_OAUTH_CLIENT_ID' ) ) {
46+
define( 'FREEMKIT_KIT_OAUTH_CLIENT_ID', 'HXZlOCj-K5r0ufuWCtyoyo3f688VmMAYSsKg1eGvw0Y' );
47+
}
48+
if ( ! defined( 'FREEMKIT_KIT_OAUTH_REDIRECT_URI' ) ) {
49+
define( 'FREEMKIT_KIT_OAUTH_REDIRECT_URI', 'https://app.kit.com/wordpress/redirect' );
50+
}
51+
52+
// Load Kit shared library classes if not already loaded by another plugin.
53+
if ( ! trait_exists( 'ConvertKit_API_Traits' ) ) {
54+
require_once FREEMKIT_PLUGIN_DIR . 'vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-traits.php';
55+
}
56+
if ( ! class_exists( 'ConvertKit_API_V4' ) ) {
57+
require_once FREEMKIT_PLUGIN_DIR . 'vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php';
58+
}
59+
if ( ! class_exists( 'ConvertKit_Log' ) ) {
60+
require_once FREEMKIT_PLUGIN_DIR . 'vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-log.php';
61+
}
62+
if ( ! class_exists( 'ConvertKit_Resource_V4' ) ) {
63+
require_once FREEMKIT_PLUGIN_DIR . 'vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php';
64+
}
65+
if ( ! class_exists( 'ConvertKit_Review_Request' ) ) {
66+
require_once FREEMKIT_PLUGIN_DIR . 'vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-review-request.php';
67+
}
68+
69+
// Autoloader.
70+
require_once FREEMKIT_PLUGIN_DIR . 'includes/autoloader.php';
71+
72+
// Register activation hook.
73+
register_activation_hook( __FILE__, array( 'WebberZone\FreemKit\Main', 'activate' ) );
74+
75+
/**
76+
* Global variable holding the current instance of FreemKit
77+
*
78+
* @since 1.0.0
79+
*
80+
* @var \WebberZone\FreemKit\Main
81+
*/
82+
global $freemkit;
83+
84+
if ( ! function_exists( __NAMESPACE__ . '\\load' ) ) {
85+
/**
86+
* The main function responsible for returning the one true instance of the plugin to functions everywhere.
87+
*
88+
* @since 1.0.0
89+
*
90+
* @return void
91+
*/
92+
function load() {
93+
freemkit();
94+
}
95+
add_action( 'plugins_loaded', __NAMESPACE__ . '\\load' );
96+
}
97+
98+
if ( ! function_exists( __NAMESPACE__ . '\\freemkit' ) ) {
99+
/**
100+
* Get the main FreemKit instance.
101+
*
102+
* @since 1.0.0
103+
* @return Main Main instance.
104+
*/
105+
function freemkit() {
106+
global $freemkit;
107+
delete_option( 'freemkit_boot_error' );
108+
109+
try {
110+
$freemkit = Main::get_instance();
111+
} catch ( \Throwable $e ) {
112+
update_option(
113+
'freemkit_boot_error',
114+
sprintf(
115+
/* translators: 1: Error message, 2: File, 3: Line. */
116+
__( 'FreemKit failed to initialize: %1$s in %2$s on line %3$d', 'freemkit' ),
117+
$e->getMessage(),
118+
$e->getFile(),
119+
$e->getLine()
120+
)
121+
);
122+
}
123+
124+
return $freemkit;
125+
}
126+
}
127+
128+
/**
129+
* Show plugin bootstrap errors in wp-admin.
130+
*
131+
* @since 1.0.0
132+
*
133+
* @return void
134+
*/
135+
function show_boot_error_notice() {
136+
if ( ! current_user_can( 'manage_options' ) ) {
137+
return;
138+
}
139+
140+
$error = get_option( 'freemkit_boot_error' );
141+
if ( empty( $error ) ) {
142+
return;
143+
}
144+
145+
printf(
146+
'<div class="notice notice-error"><p>%s</p></div>',
147+
esc_html( (string) $error )
148+
);
149+
}
150+
add_action( 'admin_notices', __NAMESPACE__ . '\\show_boot_error_notice' );

glue-link.php

Lines changed: 0 additions & 150 deletions
This file was deleted.

includes/admin/class-admin-banner.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
/**
33
* Admin Banner helper.
44
*
5-
* @package WebberZone\Glue_Link
5+
* @package WebberZone\FreemKit
66
*/
77

8-
namespace WebberZone\Glue_Link\Admin;
8+
namespace WebberZone\FreemKit\Admin;
99

10-
use WebberZone\Glue_Link\Util\Hook_Registry;
10+
use WebberZone\FreemKit\Util\Hook_Registry;
1111

1212
if ( ! defined( 'ABSPATH' ) ) {
1313
exit;

0 commit comments

Comments
 (0)