PluginProbe
FormsCRM – Connect Forms to CRM directly / 3.1
FormsCRM – Connect Forms to CRM directly v3.1
4.4.3 4.4.2 4.4.1 4.4.0 4.3.3 trunk 1.1.0 1.2.0 1.2.1 3.0 3.1 3.1.1 3.10.0 3.11.0 3.12.0 3.12.2 3.12.3 3.12.4 3.13.0 3.13.1 3.13.2 3.13.3 3.13.4 3.13.5 3.14.0 All 63 releases
formscrm / includes / debug.php

debug.php in FormsCRM – Connect Forms to CRM directly 3.1, at includes/debug.php

91 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Debug functions
4 *
5 * Functions to debug library CRM
6 *
7 * @author closemarketing
8 * @category Functions
9 * @package Gravityforms CRM
10 * @version 1.0.0
11 */
12
13 if ( ! function_exists( 'formscrm_debug_message' ) ) {
14 function formscrm_debug_message( $message ) {
15 if ( WP_DEBUG == true ) {
16 // Debug Mode
17 echo ' <table class="widefat">
18 <thead>
19 <tr class="form-invalid">
20 <th class="row-title">' . esc_html__( 'Message Debug Mode', 'formscrm' ) . '</th>
21 </tr>
22 </thead>
23 <tbody>
24 <tr>
25 <td><pre>';
26 echo esc_html( $message );
27 echo '</pre></td></tr></table>';
28 }
29 }
30 }
31
32 if ( ! function_exists( 'formscrm_error_admin_message' ) ) {
33 /**
34 * Shows in WordPress error message
35 *
36 * @param string $code Code of error.
37 * @param string $message Message.
38 * @return void
39 */
40 function formscrm_error_admin_message( $code, $message ) {
41 echo '<div class="error">';
42 echo '<p><strong>API ERROR ' . esc_html( $code ) . ': </strong> ' . esc_html( $message ) . '</p>';
43 echo '</div>';
44 }
45 }
46
47 // * Sends an email to administrator when it not creates the lead
48 if ( ! function_exists( 'formscrm_debug_email_lead' ) ) {
49 function formscrm_debug_email_lead( $crm, $error, $data ) {
50 $to = get_option( 'admin_email' );
51 $subject = 'FormsCRM - ' . __( 'Error creating the Lead', 'formscrm' );
52 $body = '<p>' . __( 'There was an error creating the Lead in the CRM', 'formscrm' ) . ' ' . $crm . ':</p><p><strong>' . $error . '</strong></p><p>' . __( 'Lead Data', 'formscrm' ) . ':</p>';
53 foreach ( $data as $dataitem ) {
54 $body .= '<p><strong>' . $dataitem['name'] . ': </strong>' . $dataitem['value'] . '</p>';
55 }
56 $body .= '</br/><br/>FormsCRM';
57 $headers = array( 'Content-Type: text/html; charset=UTF-8' );
58
59 wp_mail( $to, $subject, $body, $headers );
60 }
61 }
62
63 if ( ! function_exists( 'formscrm_testserver' ) ) {
64 function formscrm_testserver() {
65 // test curl.
66 if ( ! function_exists( 'curl_version' ) ) {
67 echo '<div id="message" class="error below-h2"><p><strong>' . __( 'curl is not Installed in your server. It is needed to work with CRM Libraries.', 'formscrm' ) . '</strong></p></div>';
68 }
69 }
70 }
71
72 if ( ! function_exists( 'formscrm_check_url_crm' ) ) {
73 /**
74 * Checks CRM URL to see that is correct
75 *
76 * @param string $url URL to check.
77 * @return url
78 */
79 function formscrm_check_url_crm( $url ) {
80
81 if ( ! isset( $url ) ) {
82 $url = '';
83 }
84 if ( substr( $url, -1 ) != '/' ) {
85 $url .= '/'; // adds slash to url.
86 }
87
88 return $url;
89 }
90 }
91