HubSpot – Free Marketing Plugin for WordPress - Version 7.5.1

Version Description

(2019.05.29) = - Fix version flags - Add unit tests - Add languages

Download this release

Release Info

Developer leadin
Plugin Icon 128x128 HubSpot – Free Marketing Plugin for WordPress
Version 7.5.1
Comparing to
See all releases

Code changes from version 7.5.0 to 7.5.1

.phpcs.xml.dist ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="WordPress Coding Standards based custom ruleset for your plugin">
3
+ <description>Generally-applicable sniffs for WordPress plugins.</description>
4
+
5
+ <!-- What to scan -->
6
+ <file>.</file>
7
+ <exclude-pattern>/vendor/</exclude-pattern>
8
+ <exclude-pattern>/node_modules/</exclude-pattern>
9
+
10
+ <!-- How to scan -->
11
+ <!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
12
+ <!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
13
+ <arg value="sp"/> <!-- Show sniff and progress -->
14
+ <arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
15
+ <arg name="colors"/>
16
+ <arg name="extensions" value="php"/>
17
+ <arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. -->
18
+
19
+ <!-- Rules: Check PHP version compatibility -->
20
+ <!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
21
+ <config name="testVersion" value="5.3-"/>
22
+ <!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
23
+ <rule ref="PHPCompatibilityWP"/>
24
+
25
+ <!-- Rules: WordPress Coding Standards -->
26
+ <!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
27
+ <!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
28
+ <config name="minimum_supported_wp_version" value="4.6"/>
29
+ <rule ref="WordPress">
30
+ <exclude name="WordPress.VIP"/>
31
+ </rule>
32
+ <rule ref="WordPress.NamingConventions.PrefixAllGlobals">
33
+ <properties>
34
+ <!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
35
+ <property name="prefixes" type="array" value="my-plugin"/>
36
+ </properties>
37
+ </rule>
38
+ <rule ref="WordPress.WP.I18n">
39
+ <properties>
40
+ <!-- Value: replace the text domain used. -->
41
+ <property name="text_domain" type="array" value="my-plugin"/>
42
+ </properties>
43
+ </rule>
44
+ <rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
45
+ <properties>
46
+ <property name="blank_line_check" value="true"/>
47
+ </properties>
48
+ </rule>
49
+ </ruleset>
bin/install-wp-tests.sh ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ if [ $# -lt 3 ]; then
4
+ echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]"
5
+ exit 1
6
+ fi
7
+
8
+ DB_NAME=$1
9
+ DB_USER=$2
10
+ DB_PASS=$3
11
+ DB_HOST=${4-localhost}
12
+ WP_VERSION=${5-latest}
13
+ SKIP_DB_CREATE=${6-false}
14
+
15
+ TMPDIR=${TMPDIR-/tmp}
16
+ TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
17
+ WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
18
+ WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}
19
+
20
+ download() {
21
+ if [ `which curl` ]; then
22
+ curl -s "$1" > "$2";
23
+ elif [ `which wget` ]; then
24
+ wget -nv -O "$2" "$1"
25
+ fi
26
+ }
27
+
28
+ if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then
29
+ WP_BRANCH=${WP_VERSION%\-*}
30
+ WP_TESTS_TAG="branches/$WP_BRANCH"
31
+
32
+ elif [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then
33
+ WP_TESTS_TAG="branches/$WP_VERSION"
34
+ elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
35
+ if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
36
+ # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
37
+ WP_TESTS_TAG="tags/${WP_VERSION%??}"
38
+ else
39
+ WP_TESTS_TAG="tags/$WP_VERSION"
40
+ fi
41
+ elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
42
+ WP_TESTS_TAG="trunk"
43
+ else
44
+ # http serves a single offer, whereas https serves multiple. we only want one
45
+ download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
46
+ grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
47
+ LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
48
+ if [[ -z "$LATEST_VERSION" ]]; then
49
+ echo "Latest WordPress version could not be found"
50
+ exit 1
51
+ fi
52
+ WP_TESTS_TAG="tags/$LATEST_VERSION"
53
+ fi
54
+ set -ex
55
+
56
+ install_wp() {
57
+
58
+ if [ -d $WP_CORE_DIR ]; then
59
+ return;
60
+ fi
61
+
62
+ mkdir -p $WP_CORE_DIR
63
+
64
+ if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
65
+ mkdir -p $TMPDIR/wordpress-nightly
66
+ download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip
67
+ unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/
68
+ mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR
69
+ else
70
+ if [ $WP_VERSION == 'latest' ]; then
71
+ local ARCHIVE_NAME='latest'
72
+ elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then
73
+ # https serves multiple offers, whereas http serves single.
74
+ download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json
75
+ if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
76
+ # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
77
+ LATEST_VERSION=${WP_VERSION%??}
78
+ else
79
+ # otherwise, scan the releases and get the most up to date minor version of the major release
80
+ local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'`
81
+ LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1)
82
+ fi
83
+ if [[ -z "$LATEST_VERSION" ]]; then
84
+ local ARCHIVE_NAME="wordpress-$WP_VERSION"
85
+ else
86
+ local ARCHIVE_NAME="wordpress-$LATEST_VERSION"
87
+ fi
88
+ else
89
+ local ARCHIVE_NAME="wordpress-$WP_VERSION"
90
+ fi
91
+ download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz
92
+ tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR
93
+ fi
94
+
95
+ download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
96
+ }
97
+
98
+ install_test_suite() {
99
+ # portable in-place argument for both GNU sed and Mac OSX sed
100
+ if [[ $(uname -s) == 'Darwin' ]]; then
101
+ local ioption='-i.bak'
102
+ else
103
+ local ioption='-i'
104
+ fi
105
+
106
+ # set up testing suite if it doesn't yet exist
107
+ if [ ! -d $WP_TESTS_DIR ]; then
108
+ # set up testing suite
109
+ mkdir -p $WP_TESTS_DIR
110
+ svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
111
+ svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
112
+ fi
113
+
114
+ if [ ! -f wp-tests-config.php ]; then
115
+ download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
116
+ # remove all forward slashes in the end
117
+ WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
118
+ sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php
119
+ sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
120
+ sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
121
+ sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
122
+ sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
123
+ fi
124
+
125
+ }
126
+
127
+ install_db() {
128
+
129
+ if [ ${SKIP_DB_CREATE} = "true" ]; then
130
+ return 0
131
+ fi
132
+
133
+ # parse DB_HOST for port or socket references
134
+ local PARTS=(${DB_HOST//\:/ })
135
+ local DB_HOSTNAME=${PARTS[0]};
136
+ local DB_SOCK_OR_PORT=${PARTS[1]};
137
+ local EXTRA=""
138
+
139
+ if ! [ -z $DB_HOSTNAME ] ; then
140
+ if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
141
+ EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
142
+ elif ! [ -z $DB_SOCK_OR_PORT ] ; then
143
+ EXTRA=" --socket=$DB_SOCK_OR_PORT"
144
+ elif ! [ -z $DB_HOSTNAME ] ; then
145
+ EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
146
+ fi
147
+ fi
148
+
149
+ # create database
150
+ mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
151
+ }
152
+
153
+ install_wp
154
+ install_test_suite
155
+ install_db
changelog.txt CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  = 7.5.0 (2019.05.22) =
2
  - Add banner to inform users if the version is outdated
3
  - Add notification that informs user if something is not working on our
1
+ = 7.5.1 (2019.05.29) =
2
+ - Fix version flags
3
+ - Add unit tests
4
+ - Add languages
5
+
6
  = 7.5.0 (2019.05.22) =
7
  - Add banner to inform users if the version is outdated
8
  - Add notification that informs user if something is not working on our
inc/class-leadin.php CHANGED
@@ -43,7 +43,7 @@ class WPLeadIn {
43
  $portalId = get_option( 'leadin_portalId' );
44
 
45
  if ( empty( $portalId ) ) {
46
- echo '<!-- HubSpot embed JS disabled as a portalId has not yet been configured -->';
47
  return;
48
  }
49
 
43
  $portalId = get_option( 'leadin_portalId' );
44
 
45
  if ( empty( $portalId ) ) {
46
+ echo '<!-- HubSpot WordPress Plugin v' . LEADIN_PLUGIN_VERSION . ': embed JS disabled as a portalId has not yet been configured -->';
47
  return;
48
  }
49
 
inc/leadin-functions.php CHANGED
@@ -60,7 +60,7 @@ function leadin_get_query_params() {
60
  return leadin_http_build_query( array(
61
  'l' => get_locale(),
62
  'php' => leadin_parse_version( phpversion() ),
63
- 'v' => get_option( 'LEADIN_PLUGIN_VERSION' ),
64
  'wp' => leadin_parse_version( $wp_version ),
65
  ) );
66
  }
@@ -121,7 +121,7 @@ function leadin_get_signup_url() {
121
 
122
  function leadin_get_ajax_url() {
123
  $ajaxUrl = get_admin_url( get_current_blog_id(), 'admin-ajax.php' );
124
- return is_ssl() ? str_replace( 'http:', 'https:', $ajaxUrl ) : str_replace( 'https:', 'http:', $ajaxUrl );
125
  }
126
 
127
  /**
60
  return leadin_http_build_query( array(
61
  'l' => get_locale(),
62
  'php' => leadin_parse_version( phpversion() ),
63
+ 'v' => LEADIN_PLUGIN_VERSION,
64
  'wp' => leadin_parse_version( $wp_version ),
65
  ) );
66
  }
121
 
122
  function leadin_get_ajax_url() {
123
  $ajaxUrl = get_admin_url( get_current_blog_id(), 'admin-ajax.php' );
124
+ return parse_url( $ajaxUrl )['path'];
125
  }
126
 
127
  /**
languages/leadin-de_AT.mo ADDED
Binary file
languages/leadin-de_CH.mo ADDED
Binary file
languages/leadin-de_CH_informal.mo ADDED
Binary file
languages/leadin-de_DE.mo ADDED
Binary file
languages/leadin-de_DE_formal.mo ADDED
Binary file
languages/leadin-en.mo ADDED
Binary file
languages/leadin-en_AU.mo ADDED
Binary file
languages/leadin-en_CA.mo ADDED
Binary file
languages/leadin-en_GB.mo ADDED
Binary file
languages/leadin-en_NZ.mo ADDED
Binary file
languages/leadin-en_US.mo ADDED
Binary file
languages/leadin-en_ZA.mo ADDED
Binary file
languages/leadin-es_AR.mo ADDED
Binary file
languages/leadin-es_CL.mo ADDED
Binary file
languages/leadin-es_CO.mo ADDED
Binary file
languages/leadin-es_CR.mo ADDED
Binary file
languages/leadin-es_ES.mo ADDED
Binary file
languages/leadin-es_GT.mo ADDED
Binary file
languages/leadin-es_MX.mo ADDED
Binary file
languages/leadin-es_PE.mo ADDED
Binary file
languages/leadin-es_PR.mo ADDED
Binary file
languages/leadin-es_VE.mo ADDED
Binary file
languages/leadin-fr_BE.mo ADDED
Binary file
languages/leadin-fr_CA.mo ADDED
Binary file
languages/leadin-fr_FR.mo ADDED
Binary file
languages/leadin-ja.mo ADDED
Binary file
languages/leadin-pt_AO.mo ADDED
Binary file
languages/leadin-pt_BR.mo ADDED
Binary file
languages/leadin-pt_PT.mo ADDED
Binary file
languages/leadin-pt_PT_ao90.mo ADDED
Binary file
leadin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: HubSpot All-In-One Marketing - Forms, Popups, Live Chat
4
  * Plugin URI: http://www.hubspot.com/integrations/wordpress
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.5.0
7
  * Author: HubSpot
8
  * Author URI: http://www.hubspot.com
9
  * License: GPL v3
@@ -60,7 +60,7 @@ if ( ! defined( 'LEADIN_DB_VERSION' ) ) {
60
  }
61
 
62
  if ( ! defined( 'LEADIN_PLUGIN_VERSION' ) ) {
63
- define( 'LEADIN_PLUGIN_VERSION', '7.5.0' );
64
  }
65
 
66
  if ( ! defined( 'LEADIN_SOURCE' ) ) {
3
  * Plugin Name: HubSpot All-In-One Marketing - Forms, Popups, Live Chat
4
  * Plugin URI: http://www.hubspot.com/integrations/wordpress
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.5.1
7
  * Author: HubSpot
8
  * Author URI: http://www.hubspot.com
9
  * License: GPL v3
60
  }
61
 
62
  if ( ! defined( 'LEADIN_PLUGIN_VERSION' ) ) {
63
+ define( 'LEADIN_PLUGIN_VERSION', '7.5.1' );
64
  }
65
 
66
  if ( ! defined( 'LEADIN_SOURCE' ) ) {
phpunit.xml.dist ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <phpunit
3
+ bootstrap="tests/bootstrap.php"
4
+ backupGlobals="false"
5
+ colors="true"
6
+ convertErrorsToExceptions="true"
7
+ convertNoticesToExceptions="true"
8
+ convertWarningsToExceptions="true"
9
+ >
10
+ <testsuites>
11
+ <testsuite>
12
+ <directory prefix="test-" suffix=".php">./tests/</directory>
13
+ </testsuite>
14
+ </testsuites>
15
+ </phpunit>
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: forms, popup, live chat, contact form, crm, newsletter, marketing, lead ge
6
  Requires at least: 4.0
7
  Tested up to: 5.2
8
  Requires PHP: 5.6
9
- Stable tag: 7.5.0
10
 
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.
12
 
@@ -164,8 +164,13 @@ Please <a href="https://community.hubspot.com?utm_source=wordpress-plugin-listin
164
 
165
  == Changelog ==
166
 
167
- - Current version: 7.5.0
168
- - Current version release: 2019-05-22
 
 
 
 
 
169
 
170
  = 7.5.0 (2019.05.22) =
171
  - Add banner to inform users if the version is outdated
6
  Requires at least: 4.0
7
  Tested up to: 5.2
8
  Requires PHP: 5.6
9
+ Stable tag: 7.5.1
10
 
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.
12
 
164
 
165
  == Changelog ==
166
 
167
+ - Current version: 7.5.1
168
+ - Current version release: 2019-05-29
169
+
170
+ = 7.5.1 (2019.05.29) =
171
+ - Fix version flags
172
+ - Add unit tests
173
+ - Add languages
174
 
175
  = 7.5.0 (2019.05.22) =
176
  - Add banner to inform users if the version is outdated
scripts/leadin.js CHANGED
@@ -59,7 +59,7 @@
59
  * DOM
60
  */
61
  var domElements = {
62
- iframe: document.getElementById('leadin-iframe'),
63
  allMenuButtons: $(
64
  '.toplevel_page_leadin > a, .toplevel_page_leadin > ul > li > a'
65
  ),
@@ -121,7 +121,7 @@
121
  var eventBus = new EventBus();
122
 
123
  function postMessage(message) {
124
- domElements.iframe.contentWindow.postMessage(
125
  JSON.stringify(message),
126
  hubspotBaseUrl
127
  );
@@ -214,6 +214,13 @@
214
  return makeRequest(action, 'GET', null, success, error);
215
  }
216
 
 
 
 
 
 
 
 
217
  return {
218
  connect: function(portalId, success, error) {
219
  post(
@@ -227,6 +234,8 @@
227
  getPortal: get.bind(null, 'leadin_get_portal'),
228
  getDomain: get.bind(null, 'leadin_get_domain'),
229
  markAsOutdated: get.bind(null, 'leadin_mark_outdated'),
 
 
230
  };
231
  })();
232
 
@@ -255,6 +264,8 @@
255
  onGetDomain: createHandler('leadin_get_wp_domain'),
256
  onMarkAsOutdated: createHandler('leadin_mark_outdated'),
257
  onUpgrade: createHandler('leadin_upgrade'),
 
 
258
  };
259
 
260
  return api;
@@ -300,7 +311,7 @@
300
  });
301
 
302
  HubspotPluginAPI.onPageReload(function() {
303
- window.location.reload();
304
  });
305
 
306
  HubspotPluginAPI.onInitNavigation(function(message, reply) {
@@ -327,6 +338,16 @@
327
  }
328
  });
329
  });
 
 
 
 
 
 
 
 
 
 
330
  };
331
 
332
  /**
@@ -341,7 +362,7 @@
341
  timeout = setTimeout(function() {
342
  WordPressPluginApi.getPortal(function(data) {
343
  if (data.portalId) {
344
- location.reload();
345
  } else if (!stop) {
346
  PortalPoll.init();
347
  }
59
  * DOM
60
  */
61
  var domElements = {
62
+ iframe: $('#leadin-iframe'),
63
  allMenuButtons: $(
64
  '.toplevel_page_leadin > a, .toplevel_page_leadin > ul > li > a'
65
  ),
121
  var eventBus = new EventBus();
122
 
123
  function postMessage(message) {
124
+ domElements.iframe[0].contentWindow.postMessage(
125
  JSON.stringify(message),
126
  hubspotBaseUrl
127
  );
214
  return makeRequest(action, 'GET', null, success, error);
215
  }
216
 
217
+ function enterFullScreen() {
218
+ domElements.iframe.addClass('leadin-iframe-fullscreen');
219
+ }
220
+
221
+ function exitFullScreen() {
222
+ domElements.iframe.removeClass('leadin-iframe-fullscreen');
223
+ }
224
  return {
225
  connect: function(portalId, success, error) {
226
  post(
234
  getPortal: get.bind(null, 'leadin_get_portal'),
235
  getDomain: get.bind(null, 'leadin_get_domain'),
236
  markAsOutdated: get.bind(null, 'leadin_mark_outdated'),
237
+ enterFullScreen: enterFullScreen,
238
+ exitFullScreen: exitFullScreen,
239
  };
240
  })();
241
 
264
  onGetDomain: createHandler('leadin_get_wp_domain'),
265
  onMarkAsOutdated: createHandler('leadin_mark_outdated'),
266
  onUpgrade: createHandler('leadin_upgrade'),
267
+ onEnterFullScreen: createHandler('leadin_enter_fullscreen'),
268
+ onExitFullScreen: createHandler('leadin_exit_fullscreen'),
269
  };
270
 
271
  return api;
311
  });
312
 
313
  HubspotPluginAPI.onPageReload(function() {
314
+ window.location.reload(true);
315
  });
316
 
317
  HubspotPluginAPI.onInitNavigation(function(message, reply) {
338
  }
339
  });
340
  });
341
+
342
+ HubspotPluginAPI.onEnterFullScreen(function(message, reply) {
343
+ WordPressPluginApi.enterFullScreen();
344
+ reply();
345
+ });
346
+
347
+ HubspotPluginAPI.onExitFullScreen(function(message, reply) {
348
+ WordPressPluginApi.exitFullScreen();
349
+ reply();
350
+ });
351
  };
352
 
353
  /**
362
  timeout = setTimeout(function() {
363
  WordPressPluginApi.getPortal(function(data) {
364
  if (data.portalId) {
365
+ location.reload(true);
366
  } else if (!stop) {
367
  PortalPoll.init();
368
  }
style/leadin-bridge.css CHANGED
@@ -23,9 +23,16 @@ body.toplevel_page_leadin {
23
  }
24
 
25
  #leadin-iframe {
26
- background-color: transparent !important;
27
  border: 0 none transparent !important;
28
  padding: 0 !important;
29
  height: 100% !important;
30
  width: 100% !important;
31
  }
 
 
 
 
 
 
 
 
23
  }
24
 
25
  #leadin-iframe {
 
26
  border: 0 none transparent !important;
27
  padding: 0 !important;
28
  height: 100% !important;
29
  width: 100% !important;
30
  }
31
+
32
+ .leadin-iframe-fullscreen {
33
+ background-color: #fff;
34
+ position: fixed !important;
35
+ top: 0px !important;
36
+ left: 0px !important;
37
+ z-index: 99999 !important;
38
+ }
style/leadin.css CHANGED
@@ -1,20 +1,18 @@
1
  @charset "UTF-8";
2
 
3
  @font-face {
4
- font-family: "hs-font";
5
- src:url("hs-font.eot");
6
- src:url("hs-font.eot?#iefix") format("embedded-opentype"),
7
- url("hs-font.woff") format("woff"),
8
- url("hs-font.ttf") format("truetype"),
9
- url("hs-font.svg#hs-font") format("svg");
10
  font-weight: normal;
11
  font-style: normal;
12
-
13
  }
14
 
15
  #wp-admin-bar-leadin-admin-menu .ab-icon:before,
16
  .dashicons-sprocket:before {
17
- font-family: "hs-font" !important;
18
  content: attr(data-icon);
19
  font-style: normal !important;
20
  font-weight: normal !important;
@@ -28,5 +26,5 @@
28
 
29
  #wp-admin-bar-leadin-admin-menu .ab-icon:before,
30
  .dashicons-sprocket:before {
31
- content: "\61";
32
  }
1
  @charset "UTF-8";
2
 
3
  @font-face {
4
+ font-family: 'hs-font';
5
+ src: url('hs-font.eot');
6
+ src: url('hs-font.eot?#iefix') format('embedded-opentype'),
7
+ url('hs-font.woff') format('woff'), url('hs-font.ttf') format('truetype'),
8
+ url('hs-font.svg#hs-font') format('svg');
 
9
  font-weight: normal;
10
  font-style: normal;
 
11
  }
12
 
13
  #wp-admin-bar-leadin-admin-menu .ab-icon:before,
14
  .dashicons-sprocket:before {
15
+ font-family: 'hs-font' !important;
16
  content: attr(data-icon);
17
  font-style: normal !important;
18
  font-weight: normal !important;
26
 
27
  #wp-admin-bar-leadin-admin-menu .ab-icon:before,
28
  .dashicons-sprocket:before {
29
+ content: '\61';
30
  }
tests/bootstrap.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPUnit bootstrap file
4
+ *
5
+ * @package Leadin
6
+ */
7
+
8
+ $_tests_dir = getenv( 'WP_TESTS_DIR' );
9
+
10
+ if ( ! $_tests_dir ) {
11
+ $_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
12
+ }
13
+
14
+ if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
15
+ echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // WPCS: XSS ok.
16
+ exit( 1 );
17
+ }
18
+
19
+ // Give access to tests_add_filter() function.
20
+ require_once $_tests_dir . '/includes/functions.php';
21
+
22
+ /**
23
+ * Manually load the plugin being tested.
24
+ */
25
+ function _manually_load_plugin() {
26
+ require dirname( dirname( __FILE__ ) ) . '/leadin.php';
27
+ }
28
+ tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
29
+
30
+ // Start up the WP testing environment.
31
+ require $_tests_dir . '/includes/bootstrap.php';
tests/inc/test-leadin-functions.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class LeadinFunctionsTest
4
+ *
5
+ * @package Leadin
6
+ */
7
+
8
+ /**
9
+ * Test leadin-functions.php
10
+ */
11
+ class LeadinFunctionsTest extends WP_UnitTestCase {
12
+
13
+ /**
14
+ * Test function leadin_get_affiliate_code
15
+ */
16
+ public function test_get_affiliate_code() {
17
+ add_option( 'hubspot_affiliate_code', 'foo' );
18
+ $this->assertEquals( leadin_get_affiliate_code(), 'foo' );
19
+ update_option( 'hubspot_affiliate_code', 'hubs.to/bar' );
20
+ $this->assertEquals( leadin_get_affiliate_code(), 'bar' );
21
+ update_option( 'hubspot_affiliate_code', 'https://xhubs.to/123' );
22
+ $this->assertEquals( leadin_get_affiliate_code(), '123' );
23
+ update_option( 'hubspot_affiliate_code', 'https://mbsy.co/xyz' );
24
+ $this->assertEquals( leadin_get_affiliate_code(), 'xyz' );
25
+ update_option( 'hubspot_affiliate_code', 'https://abc.xyz/1234' );
26
+ $this->assertEquals( leadin_get_affiliate_code(), 'https://abc.xyz/1234' );
27
+ delete_option( 'hubspot_affiliate_code' );
28
+ }
29
+ }
tests/inc/test-leadin-mark-outdated.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class LeadinFunctionsTest
4
+ *
5
+ * @package Leadin
6
+ */
7
+
8
+ /**
9
+ * Test leadin-functions.php
10
+ */
11
+ class LeadinMarkOutdatedTest extends WP_UnitTestCase {
12
+
13
+ /**
14
+ * Test function leadin_get_affiliate_code
15
+ */
16
+ public function test_mark_outdated_ajax() {
17
+
18
+ $this->assertFalse( get_option( 'leadin_outdated_version', false ) );
19
+
20
+ try {
21
+ mark_outdated_ajax();
22
+ } catch ( WPDieException $e ) {}
23
+
24
+ $this->assertTrue( isset( $e ) );
25
+ $array = json_decode( $e->getMessage() );
26
+ $this->assertTrue( isset( $array ) );
27
+ $this->assertTrue( get_option( 'leadin_outdated_version', false ) );
28
+ delete_option( 'leadin_outdated_version' );
29
+ }
30
+ }