Changeset 2083734
- Timestamp:
- 05/08/2019 03:12:47 PM (7 years ago)
- Location:
- leadin
- Files:
-
- 26 added
- 1 deleted
- 6 edited
-
tags/7.4.1 (added)
-
tags/7.4.1/admin (added)
-
tags/7.4.1/admin/leadin-admin.php (added)
-
tags/7.4.1/changelog.txt (added)
-
tags/7.4.1/images (added)
-
tags/7.4.1/images/sprocket.svg (added)
-
tags/7.4.1/inc (added)
-
tags/7.4.1/inc/class-leadin.php (added)
-
tags/7.4.1/inc/leadin-constants.php (added)
-
tags/7.4.1/inc/leadin-disconnect.php (added)
-
tags/7.4.1/inc/leadin-functions.php (added)
-
tags/7.4.1/inc/leadin-registration.php (added)
-
tags/7.4.1/leadin.php (added)
-
tags/7.4.1/license.txt (added)
-
tags/7.4.1/readme.txt (added)
-
tags/7.4.1/scripts (added)
-
tags/7.4.1/scripts/leadin.js (added)
-
tags/7.4.1/scripts/raven.min.js (added)
-
tags/7.4.1/style (added)
-
tags/7.4.1/style/hs-font.eot (added)
-
tags/7.4.1/style/hs-font.svg (added)
-
tags/7.4.1/style/hs-font.ttf (added)
-
tags/7.4.1/style/hs-font.woff (added)
-
tags/7.4.1/style/leadin-bridge.css (added)
-
tags/7.4.1/style/leadin.css (added)
-
trunk/admin/leadin-admin.php (modified) (5 diffs)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/inc/leadin-functions.php (modified) (2 diffs)
-
trunk/leadin.php (modified) (3 diffs)
-
trunk/package.json (deleted)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/scripts/leadin.js (modified) (5 diffs)
-
trunk/scripts/raven.min.js (added)
Legend:
- Unmodified
- Added
- Removed
-
leadin/trunk/admin/leadin-admin.php
r2077791 r2083734 21 21 if ( $current_screen->parent_base !== 'leadin' ) { 22 22 $leadin_icon = LEADIN_PATH . '/images/sprocket.svg'; 23 echo '<div class="notice notice-warning is-dismissible"><p><img src="' . $leadin_icon . '" height="16" style="margin-bottom: -3px" /> 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 echo '<div class="notice notice-warning is-dismissible"><p><img src="' . $leadin_icon . '" height="16" style="margin-bottom: -3px" /> ' . __('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>.', 'leadin') . '</p></div>'; 24 24 } 25 25 } … … 130 130 } 131 131 132 add_menu_page( 'HubSpot', 'HubSpot'.$notificationIcon, $capability, 'leadin', array( $this, 'leadin_build_app' ), 'dashicons-sprocket', '25.100713' );132 add_menu_page( __('HubSpot', 'leadin'), __('HubSpot', 'leadin').$notificationIcon, $capability, 'leadin', array( $this, 'leadin_build_app' ), 'dashicons-sprocket', '25.100713' ); 133 133 134 134 $portal_id = get_option('leadin_portalId'); 135 135 if ( !empty( $portal_id ) ) { 136 add_submenu_page('leadin', 'Forms', 'Forms', 'activate_plugins', 'leadin_forms', array($this, 'leadin_build_app'));137 add_submenu_page('leadin', 'Settings', 'Settings', 'activate_plugins', 'leadin_settings', array($this, 'leadin_build_app'));136 add_submenu_page('leadin', __('Forms', 'leadin'), __('Forms', 'leadin'), 'activate_plugins', 'leadin_forms', array($this, 'leadin_build_app')); 137 add_submenu_page('leadin', __('Settings', 'leadin'), __('Settings', 'leadin'), 'activate_plugins', 'leadin_settings', array($this, 'leadin_build_app')); 138 138 remove_submenu_page('leadin','leadin'); 139 139 } … … 157 157 } 158 158 $url = get_admin_url( get_current_blog_id(), "admin.php?page=$page" ); 159 $settings_link = '<a href="' . $url . '"> Settings</a>';159 $settings_link = '<a href="' . $url . '">' . __( 'Settings', 'leadin' ) . '</a>'; 160 160 array_unshift( $links, $settings_link ); 161 161 return $links; … … 173 173 174 174 if ( version_compare( phpversion(), LEADIN_REQUIRED_PHP_VERSION, '<' ) ) { 175 $error_message = "HubSpot All-In-One Marketing ".LEADIN_PLUGIN_VERSION." requires PHP ".LEADIN_REQUIRED_PHP_VERSION." or higher. Please upgrade WordPress first."; 175 $error_message = sprintf( 176 __( 'HubSpot All-In-One Marketing %1$s requires PHP %2$s or higher. Please upgrade WordPress first.', 'leadin' ), 177 LEADIN_PLUGIN_VERSION, 178 LEADIN_REQUIRED_PHP_VERSION 179 ); 180 176 181 } else if ( version_compare( $wp_version, LEADIN_REQUIRED_WP_VERSION, '<' ) ) { 177 $error_message = "HubSpot All-In-One Marketing ".LEADIN_PLUGIN_VERSION." requires PHP ".LEADIN_REQUIRED_WP_VERSION." or higher. Please upgrade WordPress first."; 182 $error_message = sprintf( 183 __( 'HubSpot All-In-One Marketing %1$s requires PHP %2$s or higher. Please upgrade WordPress first.', 'leadin' ), 184 LEADIN_PLUGIN_VERSION, 185 LEADIN_REQUIRED_WP_VERSION 186 ); 178 187 } 179 188 … … 237 246 ); 238 247 248 $leadin_i18n = array( 249 'chatflows' => __( 'Chatflows', 'leadin' ), 250 ); 251 252 wp_register_script( 'leadin-raven-js', LEADIN_PATH.'/scripts/raven.min.js' ); 239 253 wp_register_style( 'leadin-bridge-css', LEADIN_PATH.'/style/leadin-bridge.css' ); 240 wp_register_script( 'leadin-js', LEADIN_PATH.'/scripts/leadin.js', array( 'underscore' ), false, true );254 wp_register_script( 'leadin-js', LEADIN_PATH.'/scripts/leadin.js', array( 'underscore', 'leadin-raven-js' ), false, true ); 241 255 wp_localize_script( 'leadin-js', 'leadin_config', $leadin_config ); 256 wp_localize_script( 'leadin-js', 'leadin_i18n', $leadin_i18n ); 242 257 wp_enqueue_script( 'leadin-js' ); 243 258 } -
leadin/trunk/changelog.txt
r2077791 r2083734 1 = 7.4.1 (2019.05.07) = 2 - Implement faster navigation 3 - Fix signup url 4 - Use i18n on PHP 5 1 6 = 7.4.0 (2019.04.30) = 2 7 - Improve performances -
leadin/trunk/inc/leadin-functions.php
r2077791 r2083734 110 110 111 111 /** 112 * Return the signup url based on the site options 113 */ 114 function leadin_get_signup_url() { 115 $acquisition_option = get_option( 'hubspot_acquisition_attribution', '' ); 116 $affiliate_code = get_option( 'hubspot_affiliate_code' ); 117 $signup_url = LEADIN_BASE_URL . "/signup/wordpress?$acquisition_option"; 118 119 if ($affiliate_code) { 120 $destination_url = rawurlencode($signup_url); 121 return "https://mbsy.co/$affiliate_code?url=$destination_url"; 122 } 123 124 return "$signup_url&utm_source=wordpress-plugin&utm_medium=marketplaces"; 125 } 126 127 /** 112 128 * Returns the right iframe src 113 129 * The src will be `/hubspot-plugin/{portalId}/{path}`, … … 125 141 126 142 if ( empty( $portal_id ) ) { 127 return LEADIN_BASE_URL."/signup-v2/wordpress";143 return leadin_get_signup_url(); 128 144 } 129 145 -
leadin/trunk/leadin.php
r2077791 r2083734 4 4 * Plugin URI: http://www.hubspot.com/integrations/wordpress 5 5 * Description: HubSpot’s official WordPress plugin allows you to add forms, popups, and live chat to your website and integrate with the best WordPress CRM. 6 * Version: 7.4. 06 * Version: 7.4.1 7 7 * Author: HubSpot 8 8 * Author URI: http://www.hubspot.com 9 9 * License: GPL v3 10 * Text Domain: leadin 11 * Domain Path: /languages/ 10 12 * 11 13 * This program is free software: you can redistribute it and/or modify … … 59 61 60 62 if ( ! defined( 'LEADIN_PLUGIN_VERSION' ) ) { 61 define( 'LEADIN_PLUGIN_VERSION', '7.4. 0' );63 define( 'LEADIN_PLUGIN_VERSION', '7.4.1' ); 62 64 } 63 65 … … 285 287 function leadin_init() 286 288 { 289 load_plugin_textdomain( 'leadin', false, '/leadin/languages' ); 287 290 $leadin_wp = new WPLeadIn(); 288 291 add_shortcode('hubspot', 'addHubspotShortcode'); -
leadin/trunk/readme.txt
r2077791 r2083734 5 5 Tags: forms, popup, live chat, contact form, crm, newsletter, marketing, lead generation, hubspot, mailchimp, constant contact 6 6 Requires at least: 4.0 7 Tested up to: 5. 17 Tested up to: 5.2 8 8 Requires PHP: 5.6 9 Stable tag: 7.4. 09 Stable tag: 7.4.1 10 10 11 11 HubSpot All-In-One Marketing, is a free all-in-one marketing plugin that allows you to easily use HubSpot forms, popups, and live chat on your WordPress site. If you’re already a HubSpot user, the plugin lets you connect your HubSpot account to your website without any code. … … 165 165 == Changelog == 166 166 167 - Current version: 7.4.0 168 - Current version release: 2019-04-30 167 - Current version: 7.4.1 168 - Current version release: 2019-05-07 169 170 = 7.4.1 (2019.05.07) = 171 - Implement faster navigation 172 - Fix signup url 173 - Use i18n on PHP 169 174 170 175 = 7.4.0 (2019.04.30) = -
leadin/trunk/scripts/leadin.js
r2077791 r2083734 3 3 // HubSpot Env 4 4 var leadinConfig = window.leadin_config || {}; 5 var i18n = window.leadin_i18n || {}; 5 6 var hubspotBaseUrl = leadinConfig.hubspotBaseUrl; 6 7 var portalId = leadinConfig.portalId; 7 8 8 9 /** 10 * Raven 11 */ 12 function configureRaven() { 13 if (leadinConfig.env !== 'prod') { 14 return; 15 } 16 17 Raven.config( 18 'https://[email protected]/1' 19 ).install(); 20 21 Raven.setUserContext({ 22 hub: leadinConfig.portalId, 23 wp: leadinConfig.wpVersion, 24 php: leadinConfig.phpVersion, 25 v: leadinConfig.leadinPluginVersion, 26 plugins: Object.keys(leadinConfig.plugins) 27 .map(function(name, index) { 28 return name + '#' + leadinConfig.plugins[name].Version; 29 }) 30 .join(','), 31 }); 32 } 33 34 /** 35 * Event Bus 36 */ 37 function EventBus() { 38 var bus = $({}); 39 40 return { 41 trigger: function() { 42 bus.trigger.apply(bus, arguments); 43 }, 44 on: function(event, callback) { 45 bus.on(event, Raven.wrap(callback)); 46 }, 47 }; 48 } 49 50 /** 9 51 * DOM 10 52 */ 11 53 var domElements = { 12 54 iframe: document.getElementById('leadin-iframe'), 55 allMenuButtons: $( 56 '.toplevel_page_leadin > a, .toplevel_page_leadin > ul > li > a' 57 ), 58 subMenuButtons: $('.toplevel_page_leadin > ul > li'), 13 59 }; 14 60 15 61 /** 16 * Chatflows 17 */ 18 function initChatFlows() { 62 * Sidebar navigation 63 * 64 * Prevent page reloads when navigating from inside the plugin 65 */ 66 function initNavigation() { 67 function setSelectedMenuItem() { 68 domElements.subMenuButtons.removeClass('current'); 69 const pageParam = window.location.search.match(/\?page=leadin_?\w*/)[0]; // filter page query param 70 const selectedElement = $('a[href="admin.php' + pageParam + '"]'); 71 selectedElement.parent().addClass('current'); 72 } 73 74 function handleNavigation() { 75 const appRoute = window.location.search.match(/page=leadin_?(\w*)/)[1]; 76 HubspotPluginAPI.changeRoute(appRoute); 77 setSelectedMenuItem(); 78 } 79 80 // Browser back and forward events navigation 81 window.addEventListener('popstate', handleNavigation); 82 83 // Menu Navigation 84 domElements.allMenuButtons.click(function(event) { 85 event.preventDefault(); 86 window.history.pushState(null, null, $(this).attr('href')); 87 handleNavigation(); 88 }); 89 } 90 91 /** 92 * Chatflows Menu Button 93 */ 94 function initChatflows() { 19 95 var leadinMenu = document.getElementById('toplevel_page_leadin'); 20 96 var firstSubMenu = leadinMenu && leadinMenu.querySelector('.wp-first-item'); 21 97 var chatflowsUrl = hubspotBaseUrl + '/chatflows/' + portalId; 22 98 var chatflowsHtml = 23 '<li><a href="' + chatflowsUrl + '" target="_blank">Chatflows</a></li>'; 99 '<li><a href="' + 100 chatflowsUrl + 101 '" target="_blank">' + 102 i18n.chatflows + 103 '</a></li>'; 24 104 if (firstSubMenu) { 25 105 firstSubMenu.insertAdjacentHTML('afterend', chatflowsHtml); … … 31 111 */ 32 112 var Interframe = (function() { 33 var eventBus = $({});113 var eventBus = new EventBus(); 34 114 35 115 function handleMessage(message) { … … 81 161 } 82 162 163 function changeRoute(route) { 164 Interframe.postMessage({ leadin_change_route: route }); 165 } 166 83 167 var api = { 84 168 setConfig: setConfig, 169 changeRoute: changeRoute, 85 170 }; 86 171 … … 94 179 */ 95 180 var MessagesHandlers = (function() { 96 var eventBus = $({});181 var eventBus = new EventBus(); 97 182 98 183 eventBus.on('leadin_parent_ajax', function(event, payload, reply) { 99 184 var ajaxPayload = Object.assign( 100 185 { 101 complete: function(jqXHR, textStatus) {186 complete: Raven.wrap(function(jqXHR, textStatus) { 102 187 var response = Object.assign({ textStatus: textStatus }, jqXHR); 103 188 reply(response); 104 }, 105 error: function() { 189 }), 190 error: Raven.wrap(function(jqXHR) { 191 var message; 192 193 try { 194 message = JSON.parse(jqXHR.responseText).error; 195 } catch (e) { 196 message = jqXHR.responseText; 197 } 198 199 Raven.captureMessage( 200 'AJAX request failed with code ' + jqXHR.status + ': ' + message 201 ); 106 202 // TODO: sentry 107 } ,203 }), 108 204 }, 109 205 payload … … 153 249 MessagesHandlers.start(); 154 250 Interframe.init(); 155 initChatFlows(); 156 } 157 158 main(); 251 252 // Enable App Navigation only when viewing the plugin 253 if (window.location.search.indexOf('page=leadin') !== -1) { 254 initNavigation(); 255 } 256 257 initChatflows(); 258 } 259 260 configureRaven(); 261 Raven.context(main); 159 262 })(jQuery);
Note: See TracChangeset
for help on using the changeset viewer.