2
0

fix(wp): 🐛 When URL is empty

This commit is contained in:
Baptiste Arnaud
2022-03-28 14:47:19 +02:00
parent 194a5fbae1
commit 84dda32b13
4 changed files with 18 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "wordpress", "name": "wordpress",
"version": "2.1.3", "version": "2.1.4",
"main": "index.js", "main": "index.js",
"repository": "https://github.com/typebot-io/wordpress.git", "repository": "https://github.com/typebot-io/wordpress.git",
"author": "baptisteArno", "author": "baptisteArno",
@@ -10,7 +10,7 @@
}, },
"scripts": { "scripts": {
"deploy": "yarn copy && yarn commit", "deploy": "yarn copy && yarn commit",
"copy": "svn copy ./trunk ./tags/2.1.3", "copy": "svn copy ./trunk ./tags/2.1.4",
"commit": "svn ci -m 'Force viewer subdomain'" "commit": "svn ci -m 'Fix empty typebot URL'"
} }
} }

View File

@@ -5,7 +5,7 @@ Requires at least: 5.0
Tested up to: 5.9.1 Tested up to: 5.9.1
License: GPL 2.0 License: GPL 2.0
License URI: http://www.gnu.org/licenses/gpl-2.0.txt License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Stable Tag: 2.1.3 Stable Tag: 2.1.4
Build beautiful conversational forms Build beautiful conversational forms
@@ -26,6 +26,9 @@ This plugin relies on Typebot which is a tool that allows you to create conversa
3. Activate your Typebot with the "Typebot" admin button located in the sidebar 3. Activate your Typebot with the "Typebot" admin button located in the sidebar
== Changelog == == Changelog ==
= 2.1.4 =
* Fix bug when Typebot URL is empty
= 2.1.2 = = 2.1.2 =
* Fix shortcode default bot URL * Fix shortcode default bot URL

View File

@@ -25,6 +25,9 @@ class Typebot_Public
$url = str_starts_with(get_option('url'), 'https://typebot.io') $url = str_starts_with(get_option('url'), 'https://typebot.io')
? 'https://viewer.typebot.io' . '/' . explode('/', get_option('url'))[3] ? 'https://viewer.typebot.io' . '/' . explode('/', get_option('url'))[3]
: get_option('url'); : get_option('url');
if (!$url) {
return;
}
if ( if (
get_option('popup_included_pages') !== null && get_option('popup_included_pages') !== null &&
get_option('popup_included_pages') !== '' get_option('popup_included_pages') !== ''
@@ -94,6 +97,9 @@ class Typebot_Public
$url = str_starts_with(get_option('url'), 'https://typebot.io') $url = str_starts_with(get_option('url'), 'https://typebot.io')
? 'https://viewer.typebot.io' . '/' . explode('/', get_option('url'))[3] ? 'https://viewer.typebot.io' . '/' . explode('/', get_option('url'))[3]
: get_option('url'); : get_option('url');
if (!$url) {
return;
}
$chat_icon = get_option('chat_icon'); $chat_icon = get_option('chat_icon');
if ( if (
get_option('chat_included_pages') !== null && get_option('chat_included_pages') !== null &&
@@ -248,6 +254,9 @@ class Typebot_Public
$url = sanitize_text_field($attributes['url']); $url = sanitize_text_field($attributes['url']);
} }
} }
if (!$url) {
return;
}
$container_id = 'typebot-container-' . $this->generateRandomString(4); $container_id = 'typebot-container-' . $this->generateRandomString(4);
return '<script>' . return '<script>' .

View File

@@ -3,7 +3,7 @@
/** /**
* Plugin Name: Typebot * Plugin Name: Typebot
* Description: Convert more with conversational forms * Description: Convert more with conversational forms
* Version: 2.1.3 * Version: 2.1.4
* Author: Typebot * Author: Typebot
* Author URI: http://typebot.io/ * Author URI: http://typebot.io/
* License: GPL-2.0+ * License: GPL-2.0+
@@ -16,7 +16,7 @@ if (!defined('WPINC')) {
die(); die();
} }
define('TYPEBOT_VERSION', '2.1.3'); define('TYPEBOT_VERSION', '2.1.4');
function activate_typebot() function activate_typebot()
{ {