| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | $wp_chatbot_custom_agent_path = QCLD_wpCHATBOT_IMG_URL . get_option('wp_chatbot_agent_image'); |
| 15 | 15 | } else { |
| 16 | 16 | $wp_chatbot_custom_agent_path = QCLD_wpCHATBOT_IMG_URL . 'custom-agent.png'; |
| 17 | 17 | } |
| 18 | - $hidden_field = '<a class="wp-chatbot qc_wpbot_chat_link" id="wp-chatbot-search-btn" data-search-type="product" data-search-term="" style="max-height: 50px; margin-left: 10px;padding: 0 !important;position: absolute;top: -9px;right: -60px;"><img src="'. esc_url($wp_chatbot_custom_agent_path) .'" alt=""></a>'; | |
| 18 | + $hidden_field = '<a class="wp-chatbot qc_wpbot_chat_link" id="wp-chatbot-search-btn" data-search-type="product" data-search-term="" style="max-height: 50px; margin-left: 10px;padding: 0 !important;position: absolute;top: -9px;right: -60px;"><img src="'. esc_attr($wp_chatbot_custom_agent_path) .'" alt=""></a>'; | |
| 19 | 19 | $block_content = str_replace( '</form>', $hidden_field . '</form>', $form ); |
| 20 | 20 | return $block_content; |
| 21 | 21 | } |
| 22 | 22 | if(get_option('wpbot_enable_on_search') == 1 && (get_option('disable_floating_button') != '1') && get_option('disable_wp_chatbot') != 1 ){ |
| @@ -33,9 +33,9 @@ | ||
| 33 | 33 | $wp_chatbot_custom_agent_path = QCLD_wpCHATBOT_IMG_URL . get_option('wp_chatbot_agent_image'); |
| 34 | 34 | } else { |
| 35 | 35 | $wp_chatbot_custom_agent_path = QCLD_wpCHATBOT_IMG_URL . 'custom-agent.png'; |
| 36 | 36 | } |
| 37 | - $hidden_field = '<button type="button" class="wp-chatbot qc_wpbot_chat_link" id="wp-chatbot-search-btn" data-search-type="product" data-search-term="" style="max-height: 50px; margin-left: 10px;padding: 0 !important"><img src="'. esc_url($wp_chatbot_custom_agent_path) .'" alt=""></button>'; | |
| 37 | + $hidden_field = '<button type="button" class="wp-chatbot qc_wpbot_chat_link" id="wp-chatbot-search-btn" data-search-type="product" data-search-term="" style="max-height: 50px; margin-left: 10px;padding: 0 !important"><img src="'. esc_attr($wp_chatbot_custom_agent_path) .'" alt=""></button>'; | |
| 38 | 38 | // Inject the hidden field before the closing </form> tag |
| 39 | 39 | $block_content = str_replace( '</div></form>', $hidden_field . '</div></form>', $block_content ); |
| 40 | 40 | return $block_content; |
| 41 | 41 | } |
| @@ -65,9 +65,9 @@ | ||
| 65 | 65 | ?> |
| 66 | 66 | <style> |
| 67 | 67 | <?php if(get_option('wp_chatbot_custom_css')!="") { |
| 68 | 68 | |
| 69 | - echo wp_strip_all_tags( get_option('wp_chatbot_custom_css') );// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 69 | + echo wp_strip_all_tags( get_option('wp_chatbot_custom_css') ); | |
| 70 | 70 | } |
| 71 | 71 | ?> |
| 72 | 72 | </style> |
| 73 | 73 | |
| @@ -155,9 +155,9 @@ | ||
| 155 | 155 | } |
| 156 | 156 | ?> |
| 157 | 157 | <div class="wp-chatbot-notification-agent-profile"> |
| 158 | 158 | <div class="wp-chatbot-notification-widget-avatar" ><img |
| 159 | - src="<?php echo esc_url($wp_chatbot_custom_agent_path); ?>" alt=""></div> | |
| 159 | + src="<?php echo esc_attr($wp_chatbot_custom_agent_path); ?>" alt=""></div> | |
| 160 | 160 | <div class="wp-chatbot-notification-welcome"><?php echo wp_kses_post(wpb_randmom_message_handle(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome')))) . ' <strong>' . esc_html(get_option('qlcd_wp_chatbot_host')) . '</strong>'; ?></div> |
| 161 | 161 | </div> |
| 162 | 162 | <?php |
| 163 | 163 | //update_option('qlcd_wp_chatbot_notifications','Welcome to WpBot'); |
| @@ -1592,9 +1592,9 @@ | ||
| 1592 | 1592 | |
| 1593 | 1593 | if(class_exists('Qcformbuilder_Forms_Admin')){ |
| 1594 | 1594 | |
| 1595 | 1595 | |
| 1596 | - $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type= %s",'primary')); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching | |
| 1596 | + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type= %s",'primary')); //DB Call OK, No Caching OK | |
| 1597 | 1597 | |
| 1598 | 1598 | if(!empty($results)){ |
| 1599 | 1599 | |
| 1600 | 1600 | foreach($results as $result){ |
| @@ -1747,12 +1747,9 @@ | ||
| 1747 | 1747 | } |
| 1748 | 1748 | } |
| 1749 | 1749 | |
| 1750 | 1750 | function qcld_choose_random($array){ |
| 1751 | - if (is_array($array) && !empty($array)) { | |
| 1752 | - return $array[array_rand($array)]; | |
| 1753 | - } | |
| 1754 | - return $array; | |
| 1751 | + return $array[array_rand($array)]; | |
| 1755 | 1752 | } |
| 1756 | 1753 | |
| 1757 | 1754 | //User session count |
| 1758 | 1755 | add_action('wp_ajax_qcld_wb_chatbot_session_count', 'qcld_wb_chatbot_session_count'); |
| @@ -1765,22 +1762,22 @@ | ||
| 1765 | 1762 | $tableuser = $wpdb->prefix.'wpbot_sessions'; |
| 1766 | 1763 | $response = array(); |
| 1767 | 1764 | |
| 1768 | 1765 | |
| 1769 | - $session_exists = $wpdb->get_row($wpdb->prepare("select * from {$tableuser} where 1 and id = %d",1)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1766 | + $session_exists = $wpdb->get_row($wpdb->prepare("select * from $tableuser where 1 and id = %d",1)); //DB Call OK, No Caching OK | |
| 1770 | 1767 | |
| 1771 | 1768 | if(empty($session_exists)){ |
| 1772 | - $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery | |
| 1769 | + $wpdb->insert( | |
| 1773 | 1770 | $tableuser, |
| 1774 | 1771 | array( |
| 1775 | 1772 | 'session' => 1, |
| 1776 | 1773 | ) |
| 1777 | - ); | |
| 1774 | + ); //DB Call OK, No Caching OK | |
| 1778 | 1775 | }else{ |
| 1779 | 1776 | |
| 1780 | 1777 | $session_id = $session_exists->id; |
| 1781 | 1778 | |
| 1782 | - $wpdb->update( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching | |
| 1779 | + $wpdb->update( | |
| 1783 | 1780 | $tableuser, |
| 1784 | 1781 | array( |
| 1785 | 1782 | 'session'=>($session_exists->session+1), |
| 1786 | 1783 | ), |
| @@ -1788,9 +1785,9 @@ | ||
| 1788 | 1785 | array( |
| 1789 | 1786 | '%d', |
| 1790 | 1787 | ), |
| 1791 | 1788 | array('%d') |
| 1792 | - ); | |
| 1789 | + ); //DB Call OK, No Caching OK | |
| 1793 | 1790 | |
| 1794 | 1791 | } |
| 1795 | 1792 | |
| 1796 | 1793 | wp_send_json($response); |
| @@ -1798,9 +1795,9 @@ | ||
| 1798 | 1795 | |
| 1799 | 1796 | /* WPBot Chat History Addon check */ |
| 1800 | 1797 | function qcld_wpbot_is_active_chat_history(){ |
| 1801 | 1798 | |
| 1802 | - if(function_exists('qcwp_chat_session_menu_fnc') || function_exists('qcwp_chat_session_menu_fnc_free') || function_exists( 'qcpdcs_chat_session_menu_fnc' ) ){ | |
| 1799 | + if(function_exists('qcwp_chat_session_menu_fnc') || function_exists( 'qcpdcs_chat_session_menu_fnc' ) ){ | |
| 1803 | 1800 | return 1; |
| 1804 | 1801 | }else{ |
| 1805 | 1802 | return 0; |
| 1806 | 1803 | } |
| @@ -1826,10 +1823,9 @@ | ||
| 1826 | 1823 | $csvFile = file(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'small_talk.csv'); |
| 1827 | 1824 | |
| 1828 | 1825 | foreach ($csvFile as $line) { |
| 1829 | 1826 | $line = str_getcsv($line, ',', '"'); |
| 1830 | - $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery | |
| 1831 | - $table, array( | |
| 1827 | + $wpdb->insert($table, array( | |
| 1832 | 1828 | 'query' => $line[0], |
| 1833 | 1829 | 'keyword' => $line[1], |
| 1834 | 1830 | 'response' => $line[2], |
| 1835 | 1831 | 'category'=> $line[3], |
| @@ -1834,17 +1830,16 @@ | ||
| 1834 | 1830 | 'response' => $line[2], |
| 1835 | 1831 | 'category'=> $line[3], |
| 1836 | 1832 | 'intent'=> '', |
| 1837 | 1833 | //'lang'=> 'en_US', |
| 1838 | - )); | |
| 1834 | + )); //DB Call OK, No Caching OK | |
| 1839 | 1835 | } |
| 1840 | 1836 | |
| 1841 | 1837 | $table2 = $wpdb->prefix.'wpbot_response_category'; |
| 1842 | 1838 | |
| 1843 | - $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery | |
| 1844 | - $table2, array( | |
| 1839 | + $wpdb->insert($table2, array( | |
| 1845 | 1840 | 'name' => 'smalltalk', |
| 1846 | - )); | |
| 1841 | + )); //DB Call OK, No Caching OK | |
| 1847 | 1842 | |
| 1848 | 1843 | update_option( 'qcld_small_talk_imported', 'yes' ); |
| 1849 | 1844 | |
| 1850 | 1845 | } |