| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* @since 2.03.04 |
| 8 |
*/ |
| 9 |
class FrmEmailHelper { |
| 10 |
|
| 11 |
/** |
| 12 |
* Get the userID field from a form |
| 13 |
* This will not get repeating or embedded userID fields |
| 14 |
* |
| 15 |
* @since 2.03.04 |
| 16 |
* |
| 17 |
* @param int $form_id |
| 18 |
* |
| 19 |
* @return int |
| 20 |
*/ |
| 21 |
public static function get_user_id_field_for_form( $form_id ) { |
| 22 |
$where = array( |
| 23 |
'type' => 'user_id', |
| 24 |
'form_id' => $form_id, |
| 25 |
); |
| 26 |
|
| 27 |
$user_id_field = FrmDb::get_var( 'frm_fields', $where, 'id' ); |
| 28 |
|
| 29 |
return (int) $user_id_field; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* This function should only be fired when Mandrill is sending an HTML email |
| 34 |
* This will make sure Mandrill doesn't mess with our HTML emails |
| 35 |
* |
| 36 |
* @since 2.03.04 |
| 37 |
* |
| 38 |
* @return bool |
| 39 |
*/ |
| 40 |
public static function remove_mandrill_br() { |
| 41 |
return false; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Gets default from email address in header for emails. |
| 46 |
* |
| 47 |
* @since 6.15 |
| 48 |
* |
| 49 |
* @return string |
| 50 |
*/ |
| 51 |
public static function get_default_from_email() { |
| 52 |
$settings = FrmAppHelper::get_settings(); |
| 53 |
if ( $settings->from_email && is_email( $settings->from_email ) ) { |
| 54 |
return $settings->from_email; |
| 55 |
} |
| 56 |
return get_option( 'admin_email' ); |
| 57 |
} |
| 58 |
} |
| 59 |
|