Skip to content

Commit

Permalink
fix(wp): 🐛 When URL is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 28, 2022
1 parent 194a5fb commit 84dda32
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/wordpress/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wordpress",
"version": "2.1.3",
"version": "2.1.4",
"main": "index.js",
"repository": "https://github.com/typebot-io/wordpress.git",
"author": "baptisteArno",
Expand All @@ -10,7 +10,7 @@
},
"scripts": {
"deploy": "yarn copy && yarn commit",
"copy": "svn copy ./trunk ./tags/2.1.3",
"commit": "svn ci -m 'Force viewer subdomain'"
"copy": "svn copy ./trunk ./tags/2.1.4",
"commit": "svn ci -m 'Fix empty typebot URL'"
}
}
5 changes: 4 additions & 1 deletion packages/wordpress/trunk/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Requires at least: 5.0
Tested up to: 5.9.1
License: GPL 2.0
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

Expand All @@ -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

== Changelog ==
= 2.1.4 =
* Fix bug when Typebot URL is empty

= 2.1.2 =
* Fix shortcode default bot URL

Expand Down
9 changes: 9 additions & 0 deletions packages/wordpress/trunk/public/class-typebot-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ private function parse_popup_head_code()
$url = str_starts_with(get_option('url'), 'https://typebot.io')
? 'https://viewer.typebot.io' . '/' . explode('/', get_option('url'))[3]
: get_option('url');
if (!$url) {
return;
}
if (
get_option('popup_included_pages') !== null &&
get_option('popup_included_pages') !== ''
Expand Down Expand Up @@ -94,6 +97,9 @@ private function parse_bubble_head_code()
$url = str_starts_with(get_option('url'), 'https://typebot.io')
? 'https://viewer.typebot.io' . '/' . explode('/', get_option('url'))[3]
: get_option('url');
if (!$url) {
return;
}
$chat_icon = get_option('chat_icon');
if (
get_option('chat_included_pages') !== null &&
Expand Down Expand Up @@ -248,6 +254,9 @@ public function add_typebot_container($attributes = [])
$url = sanitize_text_field($attributes['url']);
}
}
if (!$url) {
return;
}
$container_id = 'typebot-container-' . $this->generateRandomString(4);

return '<script>' .
Expand Down
4 changes: 2 additions & 2 deletions packages/wordpress/trunk/typebot.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Plugin Name: Typebot
* Description: Convert more with conversational forms
* Version: 2.1.3
* Version: 2.1.4
* Author: Typebot
* Author URI: http://typebot.io/
* License: GPL-2.0+
Expand All @@ -16,7 +16,7 @@
die();
}

define('TYPEBOT_VERSION', '2.1.3');
define('TYPEBOT_VERSION', '2.1.4');

function activate_typebot()
{
Expand Down

0 comments on commit 84dda32

Please sign in to comment.