PluginProbe
Chatbot for WordPress by Collect.chat ⚡️ / trunk
Chatbot for WordPress by Collect.chat ⚡️ vtrunk
trunk 1.0 1.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 2.0.0 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 All 59 releases
collectchat / options.php

options.php in Chatbot for WordPress by Collect.chat ⚡️ trunk, at options.php

84 lines 5.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <div class="wrap">
2 <img src="https://collect.chat/assets/images/ccdark.png" style="margin-bottom: 10px;" height="50"/>
3 <div>
4 <a class="add-new-h2" target="_blank" href="<?php echo esc_url("https://help.collect.chat/article/show/56885-add-to-wordpress"); ?>"><?php _e('Read Instructions', 'collectchat'); ?></a>
5 <a class="add-new-h2" target="_blank" href="<?php echo esc_url("https://www.youtube.com/watch?v=JhcqBT0W6VQ"); ?>"><?php _e('Watch Tutorial', 'collectchat'); ?></a>
6 </div>
7
8 <hr />
9 <div id="poststuff">
10 <div id="post-body" class="metabox-holder columns-2">
11 <div id="post-body-content">
12 <div class="postbox">
13 <div class="inside">
14 <form name="dofollow" action="options.php" method="post">
15
16 <?php
17 settings_fields('collectchat-settings-group');
18 $settings = get_option('collectchat-plugin-settings');
19 $script = (array_key_exists('script', $settings) ? $settings['script'] : '');
20 $showOn = (array_key_exists('showOn', $settings) ? $settings['showOn'] : 'all');
21 $allowed_html = array(
22 'script' => array(),
23 );
24 ?>
25 <div id="collectchat-instructions">
26 <h3 class="cc-labels"><?php _e('3 Easy to steps to get started: ', 'collectchat'); ?></h3>
27 <?php
28 $userEmail = '';
29 if (wp_get_current_user() instanceof WP_User) $userEmail = wp_get_current_user()->user_email;
30 ?>
31 <p><b>1.</b> <?php _e('If you are not an existing Collect.chat user<a href="https://dashboard.collect.chat/getstarted?user=' . $userEmail . '&source=wordpress" target="_blank" class="button button-primary" style="margin: auto 15px; background-color: #208a46; border-color: #208a46; text-shadow: none; box-shadow: none;">Create a free account</a>', 'collectchat'); ?></p>
32
33 <p><b>2.</b> <?php _e('Design your Chatbot using <a href="https://dashboard.collect.chat/" target="_blank">Drag & Drop Dashboard</a>', 'collectchat'); ?></p>
34
35 <p><b>3.</b> <?php _e('Copy the code snippet from Dashboard > Share and paste it here', 'collectchat'); ?></p>
36 </div>
37 <h3 class="cc-labels" for="script"><?php _e('Chatbot Snippet:', 'collectchat'); ?></h3>
38
39 <textarea id="collectchat-plugin-snippet" style="width:100%;" rows="5" cols="50" id="script" name="collectchat-plugin-settings[script]" <?php disabled(!current_user_can( 'unfiltered_html') ); ?>><?php echo wp_kses($script, $allowed_html); ?></textarea>
40
41 <?php
42 if(!current_user_can( 'unfiltered_html' )) {
43 echo '<p style="color:#ffc107"><b>Note:</b> ' . __('You do not have permission to add or edit scripts. Please contact your administrator.', 'collectchat') . '</p>';
44 }
45 ?>
46
47 <p>
48 <h3>Show Above Chatbot On: </h3>
49 <input type="radio" name="collectchat-plugin-settings[showOn]" value="all" id="all" <?php checked('all', $showOn); ?> <?php disabled(!current_user_can( 'unfiltered_html') ); ?>> <label class="collectchat-plugin-label" for="all"><?php _e('Everywhere', 'collectchat'); ?> </label>
50 <input type="radio" name="collectchat-plugin-settings[showOn]" value="home" id="home" <?php checked('home', $showOn); ?> <?php disabled(!current_user_can( 'unfiltered_html') ); ?>> <label class="collectchat-plugin-label" for="home"><?php _e('Homepage Only', 'collectchat'); ?> </label>
51 <input type="radio" name="collectchat-plugin-settings[showOn]" value="nothome" id="nothome" <?php checked('nothome', $showOn); ?> <?php disabled(!current_user_can( 'unfiltered_html') ); ?>> <label class="collectchat-plugin-label" for="nothome"><?php _e('Everywhere except Home', 'collectchat'); ?> </label>
52 <input type="radio" name="collectchat-plugin-settings[showOn]" value="none" id="none" <?php checked('none', $showOn); ?> <?php disabled(!current_user_can( 'unfiltered_html') ); ?>> <label class="collectchat-plugin-label" for="none"><?php _e('Nowhere', 'collectchat'); ?> </label>
53 </p>
54
55 <p class="submit">
56 <input class="button button-primary" type="submit" name="Submit" value="<?php _e('Save', 'collectchat'); ?>" style="padding: 0px 30px;font-size:15px;background-color: #2c6ac3;border-color: #2c6ac3;" <?php disabled(!current_user_can( 'unfiltered_html') ); ?>/>
57 </p>
58 <p><?php _e('<b>Note:</b> You can insert different bots to specific pages or posts from respective edit sections. <a href="https://help.collect.chat/article/show/76319-in-wordpress-how-can-i-add-a-different-chatbot-for-a-different-page" target="_blank">Learn more</a>', 'collectchat'); ?></p>
59
60 </form>
61 </div>
62 </div>
63 </div>
64
65 <?php require_once (CC_PLUGIN_DIR . '/sidebar.php'); ?>
66 </div>
67 </div>
68 </div>
69
70
71 <style>
72 .collectchat-plugin-label {
73 vertical-align: initial;
74 margin-right: 5px;
75 }
76 </style>
77 <script>
78 const snippetValue = document.getElementById("collectchat-plugin-snippet") && document.getElementById("collectchat-plugin-snippet").value
79 console.log('hi',<?php wp_get_current_user() ?>);
80 if(snippetValue.indexOf('<script') !== -1) {
81 document.getElementById("collectchat-instructions").style.display = "none";
82 }
83 </script>
84