Version Description
(2018.10.03) = - Add deeper integration with HubSpot. Starts a new release of a new forms integration within WordPress. Released progressively for some users.
Download this release
Release Info
Developer | leadin |
Plugin | HubSpot – Free Marketing Plugin for WordPress |
Version | 7.0.0 |
Comparing to | |
See all releases |
Code changes from version 6.1.12 to 7.0.0
- admin/leadin-admin.php +19 -9
- images/leadin-icon-16x16.png +0 -0
- inc/class-leadin-pointers.php +0 -125
- inc/leadin-disconnect.php +6 -0
- inc/leadin-oauth-refresh.php +32 -0
- inc/leadin-registration.php +20 -1
- leadin.php +3 -2
- readme.txt +6 -3
admin/leadin-admin.php
CHANGED
@@ -17,8 +17,9 @@ if ( ! defined( 'LEADIN_ADMIN_PATH' ) ) {
|
|
17 |
// =============================================
|
18 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
19 |
|
20 |
-
|
21 |
-
|
|
|
22 |
}
|
23 |
|
24 |
// =============================================
|
@@ -104,15 +105,19 @@ class WPLeadInAdmin {
|
|
104 |
}
|
105 |
|
106 |
$leadin_icon = LEADIN_PATH . '/images/leadin-icon-16x16-white.png';
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
-
add_menu_page( 'HubSpot', 'HubSpot', $capability, 'leadin', array( $this, 'leadin_build_app' ), $leadin_icon, '25.100713' );
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
// $li_pointers = new LI_Pointers(FALSE);
|
116 |
}
|
117 |
}
|
118 |
|
@@ -180,6 +185,11 @@ class WPLeadInAdmin {
|
|
180 |
'locale' => get_locale(),
|
181 |
'timezone' => get_option( 'gmt_offset' ),
|
182 |
'timezoneString' => get_option( 'timezone_string' ), // If not set by the user manually it will be an empty string
|
|
|
|
|
|
|
|
|
|
|
183 |
);
|
184 |
|
185 |
if ( ( $pagenow == 'admin.php' && isset( $_GET['page'] ) && strstr( $_GET['page'], 'leadin' ) ) ) { // WPCS: CSRF ok.
|
17 |
// =============================================
|
18 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
19 |
|
20 |
+
function action_required_notice(){
|
21 |
+
$leadin_icon = LEADIN_PATH . '/images/leadin-icon-16x16.png';
|
22 |
+
echo '<div class="notice notice-warning is-dismissible"><p><img src="' . $leadin_icon . '" /> The HubSpot plugin isn’t connected right now. To use HubSpot tools on your WordPress site, <a href="admin.php?page=leadin">connect the plugin now</a>.</p></div>';
|
23 |
}
|
24 |
|
25 |
// =============================================
|
105 |
}
|
106 |
|
107 |
$leadin_icon = LEADIN_PATH . '/images/leadin-icon-16x16-white.png';
|
108 |
+
$notificationIcon = '';
|
109 |
+
if ( ! get_option( 'leadin_portalId' ) ) {
|
110 |
+
$notificationIcon = ' <span class="update-plugins count-1"><span class="plugin-count">!</span></span>';
|
111 |
+
add_action('admin_notices', 'action_required_notice');
|
112 |
+
}
|
113 |
|
114 |
+
add_menu_page( 'HubSpot', 'HubSpot'.$notificationIcon, $capability, 'leadin', array( $this, 'leadin_build_app' ), $leadin_icon, '25.100713' );
|
115 |
|
116 |
+
$oAuthMode = get_option('leadin_oauth_mode');
|
117 |
+
if ($oAuthMode && $oAuthMode == '1') {
|
118 |
+
add_submenu_page('leadin', 'Forms', 'Forms', 'activate_plugins', 'leadin_forms', array($this, 'leadin_build_app'));
|
119 |
+
add_submenu_page('leadin', 'Settings', 'Settings', 'activate_plugins', 'leadin_settings', array($this, 'leadin_build_app'));
|
120 |
+
remove_submenu_page('leadin','leadin');
|
|
|
121 |
}
|
122 |
}
|
123 |
|
185 |
'locale' => get_locale(),
|
186 |
'timezone' => get_option( 'gmt_offset' ),
|
187 |
'timezoneString' => get_option( 'timezone_string' ), // If not set by the user manually it will be an empty string
|
188 |
+
'oAuthMode' => get_option( 'leadin_oauth_mode' ),
|
189 |
+
'accessToken' => get_option( 'leadin_accessToken' ),
|
190 |
+
'refreshToken' => get_option( 'leadin_refreshToken' ),
|
191 |
+
'userId' => get_option( 'leadin_userId' ),
|
192 |
+
'connectionTimeInMs' => get_option( 'leadin_connectionTimeInMs' ),
|
193 |
);
|
194 |
|
195 |
if ( ( $pagenow == 'admin.php' && isset( $_GET['page'] ) && strstr( $_GET['page'], 'leadin' ) ) ) { // WPCS: CSRF ok.
|
images/leadin-icon-16x16.png
ADDED
Binary file
|
inc/class-leadin-pointers.php
DELETED
@@ -1,125 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'LEADIN_PLUGIN_VERSION' ) ) {
|
4 |
-
header( 'HTTP/1.0 403 Forbidden' );
|
5 |
-
die;
|
6 |
-
}
|
7 |
-
|
8 |
-
/**
|
9 |
-
* This class handles the pointers used in the introduction tour.
|
10 |
-
*
|
11 |
-
* @todo Add an introdutory pointer on the edit post page too.
|
12 |
-
*/
|
13 |
-
class LI_Pointers {
|
14 |
-
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Class constructor.
|
18 |
-
*/
|
19 |
-
function __construct( $new_install = false ) {
|
20 |
-
// =============================================
|
21 |
-
// Hooks & Filters
|
22 |
-
// =============================================
|
23 |
-
if ( $new_install ) {
|
24 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_new_install_pointer' ) );
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Enqueue styles and scripts needed for the pointers.
|
30 |
-
*/
|
31 |
-
function enqueue_new_install_pointer() {
|
32 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
33 |
-
return;
|
34 |
-
}
|
35 |
-
|
36 |
-
wp_enqueue_style( 'wp-pointer' );
|
37 |
-
wp_enqueue_script( 'jquery-ui' );
|
38 |
-
wp_enqueue_script( 'wp-pointer' );
|
39 |
-
wp_enqueue_script( 'utils' );
|
40 |
-
|
41 |
-
add_action( 'admin_print_footer_scripts', array( $this, 'li_settings_popup_new' ) );
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Loads in the required scripts for the pointer
|
46 |
-
*/
|
47 |
-
function enqueue_pointer_scripts() {
|
48 |
-
wp_enqueue_style( 'wp-pointer' );
|
49 |
-
wp_enqueue_script( 'jquery-ui' );
|
50 |
-
wp_enqueue_script( 'wp-pointer' );
|
51 |
-
wp_enqueue_script( 'utils' );
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Shows a popup that asks for permission to allow tracking.
|
56 |
-
*/
|
57 |
-
function li_settings_popup_new() {
|
58 |
-
$id = '#toplevel_page_leadin';
|
59 |
-
|
60 |
-
$content = '<h3>' . __( 'So close...', 'leadin' ) . '</h3>';
|
61 |
-
$content .= '<p>' . __( 'HubSpot needs just a bit more info to get up and running. Click on \'Complete Setup\' to complete the setup.', 'leadin' ) . '</p>';
|
62 |
-
|
63 |
-
$opt_arr = array(
|
64 |
-
'content' => $content,
|
65 |
-
'position' => array(
|
66 |
-
'edge' => 'left',
|
67 |
-
'align' => 'center',
|
68 |
-
),
|
69 |
-
);
|
70 |
-
|
71 |
-
$function2 = 'li_redirect_to_leadin()';
|
72 |
-
|
73 |
-
$this->print_scripts( $id, $opt_arr, 'Complete Setup', false, '', $function2 );
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Prints the pointer script
|
78 |
-
*
|
79 |
-
* @param string $selector The CSS selector the pointer is attached to.
|
80 |
-
* @param array $options The options for the pointer.
|
81 |
-
* @param string $button1 Text for button 1
|
82 |
-
* @param string|bool $button2 Text for button 2 (or false to not show it, defaults to false)
|
83 |
-
* @param string $button2_function The JavaScript function to attach to button 2
|
84 |
-
* @param string $button1_function The JavaScript function to attach to button 1
|
85 |
-
*/
|
86 |
-
function print_scripts( $selector, $options, $button1, $button2 = false, $button2_function = '', $button1_function = '' ) {
|
87 |
-
?>
|
88 |
-
<script type="text/javascript">
|
89 |
-
//<![CDATA[
|
90 |
-
(function ($) {
|
91 |
-
|
92 |
-
var li_pointer_options = <?php echo json_encode( $options ); ?>, setup;
|
93 |
-
|
94 |
-
function li_redirect_to_leadin() {
|
95 |
-
window.location.href = "<?php echo esc_url( get_bloginfo( 'wpurl' ) ); ?>/wp-admin/admin.php?page=leadin";
|
96 |
-
}
|
97 |
-
|
98 |
-
li_pointer_options = $.extend(li_pointer_options, {
|
99 |
-
buttons: function (event, t) {
|
100 |
-
button = jQuery('<a id="pointer-close" style="margin-left:5px" class="button-secondary">' + '<?php echo esc_html( $button1 ); ?>' + '</a>');
|
101 |
-
button.bind('click.pointer', function () {
|
102 |
-
window.location.href = "<?php echo esc_url( get_bloginfo( 'wpurl' ) ); ?>/wp-admin/admin.php?page=leadin";
|
103 |
-
//t.element.pointer('close');
|
104 |
-
});
|
105 |
-
return button;
|
106 |
-
},
|
107 |
-
close: function () {
|
108 |
-
}
|
109 |
-
});
|
110 |
-
|
111 |
-
setup = function () {
|
112 |
-
$('<?php echo esc_attr( $selector ); ?>').pointer(li_pointer_options).pointer('open');
|
113 |
-
};
|
114 |
-
|
115 |
-
if (li_pointer_options.position && li_pointer_options.position.defer_loading)
|
116 |
-
$(window).bind('load.wp-pointers', setup);
|
117 |
-
else
|
118 |
-
$(document).ready(setup);
|
119 |
-
})(jQuery);
|
120 |
-
//]]>
|
121 |
-
|
122 |
-
</script>
|
123 |
-
<?php
|
124 |
-
}
|
125 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/leadin-disconnect.php
CHANGED
@@ -14,6 +14,12 @@ function leadin_disconnect_ajax() {
|
|
14 |
delete_option( 'leadin_slumber_mode' );
|
15 |
delete_option( 'leadin_hapikey' );
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
wp_die( '{"message": "Success!"}' );
|
18 |
} else {
|
19 |
error_log( 'Disconnect error' );
|
14 |
delete_option( 'leadin_slumber_mode' );
|
15 |
delete_option( 'leadin_hapikey' );
|
16 |
|
17 |
+
delete_option( 'leadin_accessToken' );
|
18 |
+
delete_option( 'leadin_refreshToken' );
|
19 |
+
delete_option( 'leadin_oauth_mode' );
|
20 |
+
delete_option( 'leadin_userId' );
|
21 |
+
delete_option( 'leadin_connectionTimeInMs' );
|
22 |
+
|
23 |
wp_die( '{"message": "Success!"}' );
|
24 |
} else {
|
25 |
error_log( 'Disconnect error' );
|
inc/leadin-oauth-refresh.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'LEADIN_PLUGIN_VERSION' ) ) {
|
3 |
+
header( 'HTTP/1.0 403 Forbidden' );
|
4 |
+
wp_die();
|
5 |
+
}
|
6 |
+
|
7 |
+
if ( is_admin() ) {
|
8 |
+
add_action( 'wp_ajax_leadin_oauth_refresh_ajax', 'leadin_oauth_refresh_ajax' );
|
9 |
+
}
|
10 |
+
|
11 |
+
function leadin_oauth_refresh_ajax() {
|
12 |
+
$existingPortalId = get_option( 'leadin_portalId' );
|
13 |
+
|
14 |
+
if ( empty( $existingPortalId ) ) {
|
15 |
+
error_log( 'Refresh error' );
|
16 |
+
header( 'HTTP/1.0 400 Bad Request' );
|
17 |
+
wp_die( '{"error": "No leadin_portalId found, cannot refresh."}' );
|
18 |
+
}
|
19 |
+
|
20 |
+
$data = json_decode( file_get_contents( 'php://input' ), true );
|
21 |
+
|
22 |
+
$portalId = $data['portalId'];
|
23 |
+
$accessToken = $data['accessToken'];
|
24 |
+
|
25 |
+
if ( empty( $portalId ) || empty( $accessToken ) ) {
|
26 |
+
error_log( 'Refresh error' );
|
27 |
+
header( 'HTTP/1.0 400 Bad Request' );
|
28 |
+
wp_die( '{"error": "Refresh missing required fields"}' );
|
29 |
+
}
|
30 |
+
|
31 |
+
update_option( 'leadin_accessToken', $accessToken );
|
32 |
+
}
|
inc/leadin-registration.php
CHANGED
@@ -28,8 +28,20 @@ function leadin_registration_ajax() {
|
|
28 |
wp_die( '{"error": "Registration missing required fields"}' );
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
add_option( 'leadin_portalId', $newPortalId );
|
32 |
-
add_option( 'leadin_slumber_mode', '1' );
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
wp_die( '{"message": "Success!"}' );
|
35 |
}
|
@@ -37,6 +49,13 @@ function leadin_registration_ajax() {
|
|
37 |
function leadin_deregistration_ajax() {
|
38 |
delete_option( 'leadin_portalId' );
|
39 |
delete_option( 'leadin_hapikey' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
wp_die( '{"message": "Success!"}' );
|
42 |
}
|
28 |
wp_die( '{"error": "Registration missing required fields"}' );
|
29 |
}
|
30 |
|
31 |
+
$userId = $data['userId'];
|
32 |
+
$accessToken = $data['accessToken'];
|
33 |
+
$refreshToken = $data['refreshToken'];
|
34 |
+
$connectionTimeInMs = $data['connectionTimeInMs'];
|
35 |
+
$oAuthMode = $data['oAuthMode'];
|
36 |
+
|
37 |
add_option( 'leadin_portalId', $newPortalId );
|
38 |
+
add_option( 'leadin_slumber_mode', $oAuthMode ? '0' : '1' );
|
39 |
+
|
40 |
+
add_option( 'leadin_oauth_mode', $oAuthMode ? '1' : '0');
|
41 |
+
add_option( 'leadin_userId', $userId);
|
42 |
+
add_option( 'leadin_accessToken', $accessToken);
|
43 |
+
add_option( 'leadin_refreshToken', $refreshToken);
|
44 |
+
add_option( 'leadin_connectionTimeInMs', $connectionTimeInMs);
|
45 |
|
46 |
wp_die( '{"message": "Success!"}' );
|
47 |
}
|
49 |
function leadin_deregistration_ajax() {
|
50 |
delete_option( 'leadin_portalId' );
|
51 |
delete_option( 'leadin_hapikey' );
|
52 |
+
delete_option( 'leadin_slumber_mode' );
|
53 |
+
|
54 |
+
delete_option( 'leadin_accessToken' );
|
55 |
+
delete_option( 'leadin_refreshToken' );
|
56 |
+
delete_option( 'leadin_oauth_mode' );
|
57 |
+
delete_option( 'leadin_userId' );
|
58 |
+
delete_option( 'leadin_connectionTimeInMs' );
|
59 |
|
60 |
wp_die( '{"message": "Success!"}' );
|
61 |
}
|
leadin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Contact Form Builder for WordPress – Conversion Tools by HubSpot
|
4 |
Plugin URI: http://www.hubspot.com/products/wordpress/contact-form
|
5 |
Description: Whether you’re just getting started with HubSpot or already a HubSpot power user, Contact Form Builder for WordPress and Conversion Tools by HubSpot will let you use HubSpot tools on your WordPress website and connect the two platforms without dealing with code.
|
6 |
-
Version:
|
7 |
Author: HubSpot
|
8 |
Author URI: http://www.hubspot.com
|
9 |
License: GPL2
|
@@ -33,7 +33,7 @@ if ( ! defined( 'LEADIN_DB_VERSION' ) ) {
|
|
33 |
}
|
34 |
|
35 |
if ( ! defined( 'LEADIN_PLUGIN_VERSION' ) ) {
|
36 |
-
define( 'LEADIN_PLUGIN_VERSION', '
|
37 |
}
|
38 |
|
39 |
if ( ! defined( 'LEADIN_SOURCE' ) ) {
|
@@ -62,6 +62,7 @@ if ( file_exists( LEADIN_PLUGIN_DIR . '/inc/leadin-constants.php' ) ) {
|
|
62 |
require_once LEADIN_PLUGIN_DIR . '/inc/leadin-functions.php';
|
63 |
require_once LEADIN_PLUGIN_DIR . '/inc/leadin-registration.php';
|
64 |
require_once LEADIN_PLUGIN_DIR . '/inc/leadin-disconnect.php';
|
|
|
65 |
require_once LEADIN_PLUGIN_DIR . '/admin/leadin-admin.php';
|
66 |
|
67 |
require_once LEADIN_PLUGIN_DIR . '/inc/class-leadin.php';
|
3 |
Plugin Name: Contact Form Builder for WordPress – Conversion Tools by HubSpot
|
4 |
Plugin URI: http://www.hubspot.com/products/wordpress/contact-form
|
5 |
Description: Whether you’re just getting started with HubSpot or already a HubSpot power user, Contact Form Builder for WordPress and Conversion Tools by HubSpot will let you use HubSpot tools on your WordPress website and connect the two platforms without dealing with code.
|
6 |
+
Version: 7.0.0
|
7 |
Author: HubSpot
|
8 |
Author URI: http://www.hubspot.com
|
9 |
License: GPL2
|
33 |
}
|
34 |
|
35 |
if ( ! defined( 'LEADIN_PLUGIN_VERSION' ) ) {
|
36 |
+
define( 'LEADIN_PLUGIN_VERSION', '7.0.0' );
|
37 |
}
|
38 |
|
39 |
if ( ! defined( 'LEADIN_SOURCE' ) ) {
|
62 |
require_once LEADIN_PLUGIN_DIR . '/inc/leadin-functions.php';
|
63 |
require_once LEADIN_PLUGIN_DIR . '/inc/leadin-registration.php';
|
64 |
require_once LEADIN_PLUGIN_DIR . '/inc/leadin-disconnect.php';
|
65 |
+
require_once LEADIN_PLUGIN_DIR . '/inc/leadin-oauth-refresh.php';
|
66 |
require_once LEADIN_PLUGIN_DIR . '/admin/leadin-admin.php';
|
67 |
|
68 |
require_once LEADIN_PLUGIN_DIR . '/inc/class-leadin.php';
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: HubSpotDev, leadin
|
|
3 |
Tags: form, forms, form builder, contact form, email
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 4.9
|
6 |
-
Stable tag:
|
7 |
|
8 |
The Contact Form Builder plugin, a part of HubSpot's Conversion Tools, allows you to create WordPress forms using <a href="https://hubspot.com/products/marketing/forms?utm_source=wordpress-plugin-listing&utm_campaign=wordpress&utm_medium=marketplaces" target="_blank">HubSpot's drag & drop Form Builder</a> in a few clicks to start capturing leads on your website.
|
9 |
|
@@ -201,8 +201,11 @@ Please <a href="https://community.hubspot.com?utm_source=wordpress-plugin-listin
|
|
201 |
|
202 |
== Changelog ==
|
203 |
|
204 |
-
- Current version:
|
205 |
-
- Current version release: 2018-
|
|
|
|
|
|
|
206 |
|
207 |
= 6.1.12 (2018.09.14) =
|
208 |
- Internal update
|
3 |
Tags: form, forms, form builder, contact form, email
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 4.9
|
6 |
+
Stable tag: 7.0.0
|
7 |
|
8 |
The Contact Form Builder plugin, a part of HubSpot's Conversion Tools, allows you to create WordPress forms using <a href="https://hubspot.com/products/marketing/forms?utm_source=wordpress-plugin-listing&utm_campaign=wordpress&utm_medium=marketplaces" target="_blank">HubSpot's drag & drop Form Builder</a> in a few clicks to start capturing leads on your website.
|
9 |
|
201 |
|
202 |
== Changelog ==
|
203 |
|
204 |
+
- Current version: 7.0.0
|
205 |
+
- Current version release: 2018-10-03
|
206 |
+
|
207 |
+
= 7.0.0 (2018.10.03) =
|
208 |
+
- Add deeper integration with HubSpot. Starts a new release of a new forms integration within WordPress. Released progressively for some users.
|
209 |
|
210 |
= 6.1.12 (2018.09.14) =
|
211 |
- Internal update
|