Plugin Directory

Changeset 2083734


Ignore:
Timestamp:
05/08/2019 03:12:47 PM (7 years ago)
Author:
leadin
Message:

Release version 7.4.1

Location:
leadin
Files:
26 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • leadin/trunk/admin/leadin-admin.php

    r2077791 r2083734  
    2121  if ( $current_screen->parent_base !== 'leadin' ) {
    2222    $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>';
    2424  }
    2525}
     
    130130    }
    131131
    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' );
    133133
    134134    $portal_id = get_option('leadin_portalId');
    135135    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'));
    138138      remove_submenu_page('leadin','leadin');
    139139    }
     
    157157    }
    158158    $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>';
    160160    array_unshift( $links, $settings_link );
    161161    return $links;
     
    173173
    174174    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
    176181    } 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      );
    178187    }
    179188
     
    237246    );
    238247
     248    $leadin_i18n = array(
     249      'chatflows' => __( 'Chatflows', 'leadin' ),
     250    );
     251
     252    wp_register_script( 'leadin-raven-js', LEADIN_PATH.'/scripts/raven.min.js' );
    239253    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 );
    241255    wp_localize_script( 'leadin-js', 'leadin_config', $leadin_config );
     256    wp_localize_script( 'leadin-js', 'leadin_i18n', $leadin_i18n );
    242257    wp_enqueue_script( 'leadin-js' );
    243258  }
  • 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
    16= 7.4.0 (2019.04.30) =
    27- Improve performances
  • leadin/trunk/inc/leadin-functions.php

    r2077791 r2083734  
    110110
    111111/**
     112 * Return the signup url based on the site options
     113 */
     114function 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/**
    112128 * Returns the right iframe src
    113129 * The src will be `/hubspot-plugin/{portalId}/{path}`,
     
    125141
    126142  if ( empty( $portal_id ) ) {
    127     return LEADIN_BASE_URL."/signup-v2/wordpress";
     143    return leadin_get_signup_url();
    128144  }
    129145
  • leadin/trunk/leadin.php

    r2077791 r2083734  
    44 * Plugin URI: http://www.hubspot.com/integrations/wordpress
    55 * 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.0
     6 * Version: 7.4.1
    77 * Author: HubSpot
    88 * Author URI: http://www.hubspot.com
    99 * License: GPL v3
     10 * Text Domain: leadin
     11 * Domain Path: /languages/
    1012 *
    1113 * This program is free software: you can redistribute it and/or modify
     
    5961
    6062if ( ! defined( 'LEADIN_PLUGIN_VERSION' ) ) {
    61   define( 'LEADIN_PLUGIN_VERSION', '7.4.0' );
     63  define( 'LEADIN_PLUGIN_VERSION', '7.4.1' );
    6264}
    6365
     
    285287function leadin_init()
    286288{
     289    load_plugin_textdomain( 'leadin', false, '/leadin/languages' );
    287290    $leadin_wp = new WPLeadIn();
    288291    add_shortcode('hubspot', 'addHubspotShortcode');
  • leadin/trunk/readme.txt

    r2077791 r2083734  
    55Tags: forms, popup, live chat, contact form, crm, newsletter, marketing, lead generation, hubspot, mailchimp, constant contact
    66Requires at least: 4.0
    7 Tested up to: 5.1
     7Tested up to: 5.2
    88Requires PHP: 5.6
    9 Stable tag: 7.4.0
     9Stable tag: 7.4.1
    1010
    1111HubSpot 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.
     
    165165== Changelog ==
    166166
    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
    169174
    170175= 7.4.0 (2019.04.30) =
  • leadin/trunk/scripts/leadin.js

    r2077791 r2083734  
    33  // HubSpot Env
    44  var leadinConfig = window.leadin_config || {};
     5  var i18n = window.leadin_i18n || {};
    56  var hubspotBaseUrl = leadinConfig.hubspotBaseUrl;
    67  var portalId = leadinConfig.portalId;
    78
    89  /**
     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  /**
    951   * DOM
    1052   */
    1153  var domElements = {
    1254    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'),
    1359  };
    1460
    1561  /**
    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() {
    1995    var leadinMenu = document.getElementById('toplevel_page_leadin');
    2096    var firstSubMenu = leadinMenu && leadinMenu.querySelector('.wp-first-item');
    2197    var chatflowsUrl = hubspotBaseUrl + '/chatflows/' + portalId;
    2298    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>';
    24104    if (firstSubMenu) {
    25105      firstSubMenu.insertAdjacentHTML('afterend', chatflowsHtml);
     
    31111   */
    32112  var Interframe = (function() {
    33     var eventBus = $({});
     113    var eventBus = new EventBus();
    34114
    35115    function handleMessage(message) {
     
    81161    }
    82162
     163    function changeRoute(route) {
     164      Interframe.postMessage({ leadin_change_route: route });
     165    }
     166
    83167    var api = {
    84168      setConfig: setConfig,
     169      changeRoute: changeRoute,
    85170    };
    86171
     
    94179   */
    95180  var MessagesHandlers = (function() {
    96     var eventBus = $({});
     181    var eventBus = new EventBus();
    97182
    98183    eventBus.on('leadin_parent_ajax', function(event, payload, reply) {
    99184      var ajaxPayload = Object.assign(
    100185        {
    101           complete: function(jqXHR, textStatus) {
     186          complete: Raven.wrap(function(jqXHR, textStatus) {
    102187            var response = Object.assign({ textStatus: textStatus }, jqXHR);
    103188            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            );
    106202            // TODO: sentry
    107           },
     203          }),
    108204        },
    109205        payload
     
    153249    MessagesHandlers.start();
    154250    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);
    159262})(jQuery);
Note: See TracChangeset for help on using the changeset viewer.