';
echo esc_html( $message );
echo ' |
';
}
}
}
if ( ! function_exists( 'formscrm_error_admin_message' ) ) {
/**
* Shows in WordPress error message
*
* @param string $code Code of error.
* @param string $message Message.
* @return void
*/
function formscrm_error_admin_message( $code, $message ) {
echo '';
echo '
API ERROR ' . esc_html( $code ) . ': ' . esc_html( $message ) . '
';
echo '
';
}
}
// * Sends an email to administrator when it not creates the lead
if ( ! function_exists( 'formscrm_debug_email_lead' ) ) {
function formscrm_debug_email_lead( $crm, $error, $data ) {
$to = get_option( 'admin_email' );
$subject = 'FormsCRM - ' . __( 'Error creating the Lead', 'formscrm' );
$body = '' . __( 'There was an error creating the Lead in the CRM', 'formscrm' ) . ' ' . $crm . ':
' . $error . '
' . __( 'Lead Data', 'formscrm' ) . ':
';
foreach ( $data as $dataitem ) {
$body .= '' . $dataitem['name'] . ': ' . $dataitem['value'] . '
';
}
$body .= '
FormsCRM';
$headers = array( 'Content-Type: text/html; charset=UTF-8' );
wp_mail( $to, $subject, $body, $headers );
}
}
if ( ! function_exists( 'formscrm_testserver' ) ) {
function formscrm_testserver() {
// test curl.
if ( ! function_exists( 'curl_version' ) ) {
echo '' . __( 'curl is not Installed in your server. It is needed to work with CRM Libraries.', 'formscrm' ) . '
';
}
}
}
if ( ! function_exists( 'formscrm_check_url_crm' ) ) {
/**
* Checks CRM URL to see that is correct
*
* @param string $url URL to check.
* @return url
*/
function formscrm_check_url_crm( $url ) {
if ( ! isset( $url ) ) {
$url = '';
}
if ( substr( $url, -1 ) != '/' ) {
$url .= '/'; // adds slash to url.
}
return $url;
}
}