-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjotform-oembed.php
More file actions
65 lines (53 loc) · 2.28 KB
/
jotform-oembed.php
File metadata and controls
65 lines (53 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/*
Plugin Name: oEmbed — Embed Form Securely - Jotform
Plugin URI: https://wordpress.org/plugins/jotform-oembed/
Description: Adding a web form to your blog post is now very easy using Jotform’s oEmbed plugin. When you install it, WordPress will be aware of Jotform form URLs, and easily embed them to your blog posts.
Version: 1.3.4
Author: Jotform
Author URI: https://www.jotform.com/
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit(0);
}
class JotFormOEmbed {
public function __construct() {
wp_oembed_add_provider('#https?://(secure\.|www\.|form\.|app\.)?(my)?jotform(pro|eu|z)?\.(com|net|us|ca|me|co)(/form|/app|/agent)?/[0-9a-z]*#i', 'https://www.jotform.com/oembed/', true);
add_action('admin_notices', array($this, 'showNewPluginNotification'));
add_action('wp_ajax_jotform-ai-chatbot_dismiss_notice', array($this, 'dismissNewPluginNotification'));
}
public function showNewPluginNotification() {
if (!current_user_can('manage_options')) {
return;
}
if (get_option('jotform-ai-chatbot_admin_notice_dismissed')) {
return;
}
$plugin_slug = 'jotform-ai-chatbot';
$plugin_url = "plugin-install.php?tab=plugin-information&plugin=$plugin_slug&TB_iframe=true&width=600&height=550";
?>
<div class="notice notice-info is-dismissible" id="jotform-ai-chatbot-admin-notice">
<p>🚀 <strong>Meet Jotform AI Chatbot!</strong> Automate support, boost engagement & generate leads. No coding needed. <a href="<?php echo esc_url($plugin_url); ?>" class="thickbox">Try it now!</a> 🤖✨</p>
</div>
<?php
add_thickbox();
?>
<script>
jQuery(document).on('click', '#jotform-ai-chatbot-admin-notice .notice-dismiss', function () {
jQuery.post(ajaxurl, {
action: 'jotform-ai-chatbot_dismiss_notice'
});
});
</script>
<?php
}
public function dismissNewPluginNotification() {
update_option('jotform-ai-chatbot_admin_notice_dismissed', true);
wp_die();
}
}
$jotformOEmbed = new JotFormOEmbed();
?>