本文整理汇总了PHP中RGFormsModel::get_field方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_field方法的具体用法?PHP RGFormsModel::get_field怎么用?PHP RGFormsModel::get_field使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::get_field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: leads_page
public static function leads_page($form_id)
{
global $wpdb;
//quit if version of wp is not supported
if (!GFCommon::ensure_wp_version()) {
return;
}
$form_id = absint($form_id);
echo GFCommon::get_remote_message();
$action = RGForms::post('action');
$filter = rgget('filter');
$search = stripslashes(rgget('s'));
$page_index = empty($_GET['paged']) ? 0 : intval($_GET['paged']) - 1;
$star = $filter == 'star' ? 1 : null;
$read = $filter == 'unread' ? 0 : null;
$status = in_array($filter, array('trash', 'spam')) ? $filter : 'active';
$form = RGFormsModel::get_form_meta($form_id);
$search_criteria['status'] = $status;
if ($star) {
$search_criteria['field_filters'][] = array('key' => 'is_starred', 'value' => (bool) $star);
}
if (!is_null($read)) {
$search_criteria['field_filters'][] = array('key' => 'is_read', 'value' => (bool) $read);
}
$search_field_id = rgget('field_id');
$search_operator = rgget('operator');
if (isset($_GET['field_id']) && $_GET['field_id'] !== '') {
$key = $search_field_id;
$val = stripslashes(rgget('s'));
$strpos_row_key = strpos($search_field_id, '|');
if ($strpos_row_key !== false) {
//multi-row likert
$key_array = explode('|', $search_field_id);
$key = $key_array[0];
$val = $key_array[1] . ':' . $val;
}
if ('entry_id' == $key) {
$key = 'id';
}
$filter_operator = empty($search_operator) ? 'is' : $search_operator;
$field = GFFormsModel::get_field($form, $key);
if ($field) {
$input_type = GFFormsModel::get_input_type($field);
if ($field->type == 'product' && in_array($input_type, array('radio', 'select'))) {
$filter_operator = 'contains';
}
}
$search_criteria['field_filters'][] = array('key' => $key, 'operator' => $filter_operator, 'value' => $val);
}
$update_message = '';
switch ($action) {
case 'delete':
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$lead_id = $_POST['action_argument'];
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
RGFormsModel::delete_lead($lead_id);
$update_message = esc_html__('Entry deleted.', 'gravityforms');
} else {
$update_message = esc_html__("You don't have adequate permission to delete entries.", 'gravityforms');
}
break;
case 'bulk':
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$bulk_action = !empty($_POST['bulk_action']) ? $_POST['bulk_action'] : $_POST['bulk_action2'];
$select_all = rgpost('all_entries');
$leads = empty($select_all) ? $_POST['lead'] : GFFormsModel::search_lead_ids($form_id, $search_criteria);
$entry_count = count($leads) > 1 ? sprintf(esc_html__('%d entries', 'gravityforms'), count($leads)) : esc_html__('1 entry', 'gravityforms');
switch ($bulk_action) {
case 'delete':
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
RGFormsModel::delete_leads($leads);
$update_message = sprintf(esc_html__('%s deleted.', 'gravityforms'), $entry_count);
} else {
$update_message = esc_html__("You don't have adequate permission to delete entries.", 'gravityforms');
}
break;
case 'trash':
RGFormsModel::update_leads_property($leads, 'status', 'trash');
$update_message = sprintf(esc_html__('%s moved to Trash.', 'gravityforms'), $entry_count);
break;
case 'restore':
RGFormsModel::update_leads_property($leads, 'status', 'active');
$update_message = sprintf(esc_html__('%s restored from the Trash.', 'gravityforms'), $entry_count);
break;
case 'unspam':
RGFormsModel::update_leads_property($leads, 'status', 'active');
$update_message = sprintf(esc_html__('%s restored from the spam.', 'gravityforms'), $entry_count);
break;
case 'spam':
RGFormsModel::update_leads_property($leads, 'status', 'spam');
$update_message = sprintf(esc_html__('%s marked as spam.', 'gravityforms'), $entry_count);
break;
case 'mark_read':
RGFormsModel::update_leads_property($leads, 'is_read', 1);
$update_message = sprintf(esc_html__('%s marked as read.', 'gravityforms'), $entry_count);
break;
case 'mark_unread':
RGFormsModel::update_leads_property($leads, 'is_read', 0);
$update_message = sprintf(esc_html__('%s marked as unread.', 'gravityforms'), $entry_count);
break;
//.........这里部分代码省略.........
示例2: field_label
/**
* Fetch Field Label
*
* @access public
* @static
* @param array $field GravityView field array
* @param array $entry Gravity Forms entry array
* @param boolean $force_show_label Whether to always show the label, regardless of field settings
* @return string
*/
public static function field_label($field, $entry = array(), $force_show_label = false)
{
$gravityview_view = GravityView_View::getInstance();
$form = $gravityview_view->getForm();
$label = '';
if (!empty($field['show_label']) || $force_show_label) {
$label = $field['label'];
// Support Gravity Forms 1.9+
if (class_exists('GF_Field')) {
$field_object = RGFormsModel::get_field($form, $field['id']);
if ($field_object) {
$input = GFFormsModel::get_input($field_object, $field['id']);
// This is a complex field, with lables on a per-input basis
if ($input) {
// Does the input have a custom label on a per-input basis? Otherwise, default label.
$label = !empty($input['customLabel']) ? $input['customLabel'] : $input['label'];
} else {
// This is a field with one label
$label = $field_object->get_field_label(true, $field['label']);
}
}
}
// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
if (!empty($field['custom_label'])) {
$label = self::replace_variables($field['custom_label'], $form, $entry);
}
$label .= apply_filters('gravityview_render_after_label', '', $field);
}
// End $field['show_label']
/**
* @since 1.7
*/
$label = apply_filters('gravityview/template/field_label', $label, $field, $form, $entry);
return $label;
}
示例3: is_condition_true
/**
* Check if the iDEAL condition is true
*
* @param mixed $form
* @param mixed $feed
*/
public static function is_condition_true($form, $feed)
{
if (!$feed->condition_enabled) {
return true;
}
$field = RGFormsModel::get_field($form, $feed->condition_field_id);
// Unknown field
if (empty($field)) {
return true;
}
$is_hidden = RGFormsModel::is_field_hidden($form, $field, array());
// Ignore condition if the field is hidden
if ($is_hidden) {
return false;
}
$value = RGFormsModel::get_field_value($field, array());
$is_match = RGFormsModel::is_value_match($value, $feed->condition_value);
switch ($feed->condition_operator) {
case Pronamic_WP_Pay_Extensions_GravityForms_GravityForms::OPERATOR_IS:
$result = $is_match;
break;
case Pronamic_WP_Pay_Extensions_GravityForms_GravityForms::OPERATOR_IS_NOT:
$result = !$is_match;
break;
default:
$result = true;
}
return $result;
}
示例4: _filter_field_label
/**
* When showing a single column values, display the label of the column instead of the field
*
* @since 1.14
*
* @param string $label Existing label string
* @param array $field GV field settings array, with `id`, `show_label`, `label`, `custom_label`, etc. keys
* @param array $form Gravity Forms form array
* @param array $entry Gravity Forms entry array
*
* @return string Existing label if the field isn't
*/
public function _filter_field_label($label, $field, $form, $entry)
{
$field_object = RGFormsModel::get_field($form, $field['id']);
// Not a list field
if (!$field_object || 'list' !== $field_object->type) {
return $label;
}
// Custom label is defined, so use it
if (!empty($field['custom_label'])) {
return $label;
}
$field_id_array = explode('.', $field['id']);
// Parent field, not column field
if (!isset($field_id_array[1])) {
return $label;
}
$column_id = intval($field_id_array[1]);
return self::get_column_label($field_object, $column_id, $label);
}
示例5: is_condition_true
/**
* Check if the iDEAL condition is true
*
* @param mixed $form
* @param mixed $feed
*/
public static function is_condition_true($form, $feed)
{
$result = true;
if ($feed->condition_enabled) {
$field = RGFormsModel::get_field($form, $feed->condition_field_id);
if (empty($field)) {
// unknown field
$result = true;
} else {
$is_hidden = RGFormsModel::is_field_hidden($form, $field, array());
if ($is_hidden) {
// if conditional is enabled, but the field is hidden, ignore conditional
$result = false;
} else {
$value = RGFormsModel::get_field_value($field, array());
$is_match = RGFormsModel::is_value_match($value, $feed->condition_value);
switch ($feed->condition_operator) {
case Pronamic_WP_Pay_Extensions_GravityForms_GravityForms::OPERATOR_IS:
$result = $is_match;
break;
case Pronamic_WP_Pay_Extensions_GravityForms_GravityForms::OPERATOR_IS_NOT:
$result = !$is_match;
break;
default:
// unknown operator
$result = true;
break;
}
}
}
} else {
// condition is disabled, result is true
$result = true;
}
return $result;
}
示例6: handle_existing_images_submission
public static function handle_existing_images_submission($form)
{
global $_gf_uploaded_files;
// get UR config
// get all fileupload fields mapped in the UR config
// foreach loop through and see if the image has been:
// - resubmitted populate the existing image data into the $_gf_uploaded_files
// - deleted do nothing
// - new image submitted do nothing
if (empty($_gf_uploaded_files)) {
$_gf_uploaded_files = array();
}
$config = GFUserData::get_update_feed($form['id']);
if (!$config) {
return;
}
$meta = rgars($config, 'meta/user_meta');
if (function_exists('xprofile_get_field_data')) {
$bp_meta = rgars($config, 'meta/buddypress_meta');
if (is_array($bp_meta)) {
$bp_meta = array_map(create_function('$a', '$a["is_bp"] = true; return $a;'), $bp_meta);
$meta = array_merge($meta, $bp_meta);
}
}
foreach ($meta as $meta_item) {
$field = RGFormsModel::get_field($form, $meta_item['meta_value']);
$input_name = "input_{$field['id']}";
if (RGFormsModel::get_input_type($field) != 'fileupload') {
continue;
}
if (self::is_prepopulated_file_upload($form['id'], $input_name)) {
if (rgar($meta_item, 'is_bp')) {
$_gf_uploaded_files[$input_name] = xprofile_get_field_data($meta_item['meta_name'], get_current_user_id());
} else {
$_gf_uploaded_files[$input_name] = get_user_meta(get_current_user_id(), $meta_item['meta_name'], true);
}
}
}
}
示例7: is_optin
public static function is_optin($form, $settings)
{
$config = $settings["meta"];
$operator = $config["optin_operator"];
$field = RGFormsModel::get_field($form, $config["optin_field_id"]);
$field_value = RGFormsModel::get_field_value($field, array());
$is_value_match = RGFormsModel::is_value_match($field_value, $config["optin_value"]);
return !$config["optin_enabled"] || empty($field) || $operator == "is" && $is_value_match || $operator == "isnot" && !$is_value_match;
}
示例8: fix_checkbox_value
private static function fix_checkbox_value()
{
global $wpdb;
$table_name = RGFormsModel::get_lead_details_table_name();
$sql = "select * from {$table_name} where value= '!'";
$results = $wpdb->get_results($sql);
foreach ($results as $result) {
$form = RGFormsModel::get_form_meta($result->form_id);
$field = RGFormsModel::get_field($form, $result->field_number);
if ($field->type == 'checkbox') {
$input = GFCommon::get_input($field, $result->field_number);
$wpdb->update($table_name, array('value' => $input['label']), array('id' => $result->id));
}
}
}
示例9: get_field_value_long
public static function get_field_value_long($lead, $field_number, $form, $apply_filter = true)
{
global $wpdb;
$detail_table_name = self::get_lead_details_table_name();
$long_table_name = self::get_lead_details_long_table_name();
$sql = $wpdb->prepare(" SELECT l.value FROM {$detail_table_name} d\n INNER JOIN {$long_table_name} l ON l.lead_detail_id = d.id\n WHERE lead_id=%d AND field_number BETWEEN %s AND %s", $lead['id'], doubleval($field_number) - 0.0001, doubleval($field_number) + 0.0001);
$val = $wpdb->get_var($sql);
//running aform_get_input_value when needed
if ($apply_filter) {
$field = RGFormsModel::get_field($form, $field_number);
$input_id = (string) $field_number == (string) $field->id ? '' : $field_number;
$val = apply_filters('gform_get_input_value', $val, $lead, $field, $input_id);
}
return $val;
}
示例10: is_optin
public static function is_optin($form, $settings, $entry)
{
$config = $settings["meta"];
$field = RGFormsModel::get_field($form, $config["optin_field_id"]);
if (empty($field) || !$config["optin_enabled"]) {
return true;
}
$operator = $config["optin_operator"];
$field_value = RGFormsModel::get_lead_field_value($entry, $field);
$is_value_match = RGFormsModel::is_value_match($field_value, $config["optin_value"]);
$is_visible = !RGFormsModel::is_field_hidden($form, $field, array(), $entry);
$is_match = $is_value_match && $is_visible;
$is_optin = $operator == "is" && $is_match || $operator == "isnot" && !$is_match;
return $is_optin;
}
示例11: start_export
public static function start_export($form)
{
$form_id = $form["id"];
$fields = $_POST["export_field"];
$start_date = $_POST["export_date_start"];
$end_date = $_POST["export_date_end"];
//adding default fields
array_push($form["fields"], array("id" => "id", "label" => __("Entry Id", "gravityforms")));
array_push($form["fields"], array("id" => "date_created", "label" => __("Entry Date", "gravityforms")));
array_push($form["fields"], array("id" => "ip", "label" => __("User IP", "gravityforms")));
array_push($form["fields"], array("id" => "source_url", "label" => __("Source Url", "gravityforms")));
array_push($form["fields"], array("id" => "payment_status", "label" => __("Payment Status", "gravityforms")));
array_push($form["fields"], array("id" => "payment_date", "label" => __("Payment Date", "gravityforms")));
array_push($form["fields"], array("id" => "transaction_id", "label" => __("Transaction Id", "gravityforms")));
$entry_count = RGFormsModel::get_lead_count($form_id, "", null, null, $start_date, $end_date);
$page_size = 200;
$offset = 0;
//Adding BOM marker for UTF-8
$lines = chr(239) . chr(187) . chr(191);
//writing header
foreach ($fields as $field_id) {
$field = RGFormsModel::get_field($form, $field_id);
$value = '"' . str_replace('"', '""', GFCommon::get_label($field, $field_id)) . '"';
$lines .= "{$value},";
}
$lines = substr($lines, 0, strlen($lines) - 1) . "\n";
//paging through results for memory issues
while ($entry_count > 0) {
$leads = RGFormsModel::get_leads($form_id, "date_created", "DESC", "", $offset, $page_size, null, null, false, $start_date, $end_date);
foreach ($leads as $lead) {
foreach ($fields as $field_id) {
$long_text = "";
if (strlen($lead[$field_id]) >= GFORMS_MAX_FIELD_LENGTH) {
$long_text = RGFormsModel::get_field_value_long($lead["id"], $field_id);
}
$value = !empty($long_text) ? $long_text : $lead[$field_id];
$lines .= '"' . str_replace('"', '""', $value) . '",';
}
$lines = substr($lines, 0, strlen($lines) - 1);
$lines .= "\n";
}
$offset += $page_size;
$entry_count -= $page_size;
if (!seems_utf8($lines)) {
$lines = utf8_encode($lines);
}
echo $lines;
$lines = "";
}
}
示例12: entries_import
/**
*
* @global type $wpdb
*/
function entries_import()
{
$wform = $_REQUEST['form'];
$gform = $_REQUEST['gform'];
$entry_index = $_REQUEST['entry_index'];
$this->init();
$field_map = maybe_unserialize(get_site_option('rt_wufoo_' . $wform . '_field_map'));
$f = new RGFormsModel();
$c = new GFCommon();
$gform_meta = RGFormsModel::get_form_meta($gform);
try {
$entries = $this->wufoo->getEntries($wform, 'forms', 'pageStart=' . $entry_index . '&pageSize=' . RT_WUFOO_IMPORT_PAGE_SIZE);
} catch (Exception $rt_importer_e) {
$this->error($rt_importer_e);
}
$this->op = array();
foreach ($entries as $index => $entry) {
$lead_exists_id = $this->is_imported($entry->EntryId);
print_r($lead_exists_id);
if (!$lead_exists_id) {
foreach ($field_map as $g_id => $w_id) {
if (isset($w_id) && $w_id != '') {
$this->op[$g_id] = '';
$field_meta = RGFormsModel::get_field($gform_meta, $g_id);
if ($field_meta['type'] == 'fileupload') {
$this->op[$g_id] = $this->import_file_upload($entry, $w_id);
} else {
$this->import_regular_field($wform, $entry, $g_id, $w_id, $field_meta);
}
}
}
$currency = $c->get_currency();
$ip = $f->get_ip();
$page = $f->get_current_page_url();
$lead_table = $f->get_lead_table_name();
$lead_id = $this->insert_lead($entry, $lead_table, $ip, $currency, $page, $wform, $gform);
}
if ($lead_id) {
foreach ($this->op as $inputid => $value) {
$this->insert_fields($lead_id, $gform, $inputid, $value);
}
//Insert comments as notes for the corresponding user map
$comments = $this->get_comments_by_entry($wform, $entry->EntryId);
if (isset($comments) && !empty($comments)) {
foreach ($comments as $comment) {
$this->move_comments_for_entry($comment, $f->get_lead_notes_table_name(), $lead_id, $wform);
}
}
} else {
$lead_id = $lead_exists_id;
}
gform_update_meta($lead_id, 'rt_wufoo_entry_id', $entry->EntryId);
}
//update_site_option('rt_wufoo_' . $wform . '_entry_complete_count','0');
echo count($entries) + $entry_index;
die;
}
示例13: maybe_update_post_fields
/**
* Loop through the fields being edited and if they include Post fields, update the Entry's post object
*
* @param array $form Gravity Forms form
*
* @return void
*/
function maybe_update_post_fields($form)
{
$post_id = $this->entry['post_id'];
// Security check
if (false === GVCommon::has_cap('edit_post', $post_id)) {
do_action('gravityview_log_error', 'The current user does not have the ability to edit Post #' . $post_id);
return;
}
$update_entry = false;
$updated_post = $original_post = get_post($post_id);
foreach ($this->entry as $field_id => $value) {
//todo: only run through the edit entry configured fields
$field = RGFormsModel::get_field($form, $field_id);
if (class_exists('GF_Fields')) {
$field = GF_Fields::create($field);
}
if (GFCommon::is_post_field($field)) {
// Get the value of the field, including $_POSTed value
$value = RGFormsModel::get_field_value($field);
// Convert the field object in 1.9 to an array for backward compatibility
$field_array = GVCommon::get_field_array($field);
switch ($field_array['type']) {
case 'post_title':
case 'post_content':
case 'post_excerpt':
$updated_post->{$field_array['type']} = $value;
break;
case 'post_tags':
wp_set_post_tags($post_id, $value, false);
break;
case 'post_category':
$categories = is_array($value) ? array_values($value) : (array) $value;
$categories = array_filter($categories);
wp_set_post_categories($post_id, $categories, false);
// prepare value to be saved in the entry
$field = GFCommon::add_categories_as_choices($field, '');
// if post_category is type checkbox, then value is an array of inputs
if (isset($value[strval($field_id)])) {
foreach ($value as $input_id => $val) {
$input_name = 'input_' . str_replace('.', '_', $input_id);
$this->entry[strval($input_id)] = RGFormsModel::prepare_value($form, $field, $val, $input_name, $this->entry['id']);
}
} else {
$input_name = 'input_' . str_replace('.', '_', $field_id);
$this->entry[strval($field_id)] = RGFormsModel::prepare_value($form, $field, $value, $input_name, $this->entry['id']);
}
break;
case 'post_custom_field':
$input_type = RGFormsModel::get_input_type($field);
$custom_field_name = $field_array['postCustomFieldName'];
// Only certain custom field types are supported
if (!in_array($input_type, array('list', 'fileupload'))) {
update_post_meta($post_id, $custom_field_name, $value);
}
break;
case 'post_image':
$value = '';
break;
}
//ignore fields that have not changed
if ($value === rgget((string) $field_id, $this->entry)) {
continue;
}
// update entry
if ('post_category' !== $field->type) {
$this->entry[strval($field_id)] = $value;
}
$update_entry = true;
}
}
if ($update_entry) {
$return_entry = GFAPI::update_entry($this->entry);
if (is_wp_error($return_entry)) {
do_action('gravityview_log_error', 'Updating the entry post fields failed', $return_entry);
} else {
do_action('gravityview_log_debug', 'Updating the entry post fields for post #' . $post_id . ' succeeded');
}
}
$return_post = wp_update_post($updated_post, true);
if (is_wp_error($return_post)) {
do_action('gravityview_log_error', 'Updating the post content failed', $return_post);
} else {
do_action('gravityview_log_debug', 'Updating the post content for post #' . $post_id . ' succeeded');
}
}
示例14: ajax_get_more_results
public static function ajax_get_more_results()
{
$form_id = rgpost("form_id");
$field_id = rgpost("field_id");
$offset = rgpost("offset");
$search_criteria = rgpost("search_criteria");
if (empty($search_criteria)) {
$search_criteria = array();
}
$page_size = 10;
$form = RGFormsModel::get_form_meta($form_id);
$form_id = $form["id"];
$field = RGFormsModel::get_field($form, $field_id);
$entry_count = GFFormsModel::count_search_leads($form_id, $search_criteria);
$html = self::get_default_field_results($form_id, $field, $search_criteria, $offset, $page_size);
$remaining = $entry_count - ($page_size + $offset);
$remaining = $remaining < 0 ? 0 : $remaining;
$response = array();
$response["remaining"] = $remaining;
$response['html'] = $html;
echo json_encode($response);
die;
}
示例15: send_notification
public static function send_notification($notification, $form, $lead)
{
$notification = apply_filters("gform_notification_{$form["id"]}", apply_filters("gform_notification", $notification, $form, $lead), $form, $lead);
$to_field = "";
if (rgar($notification, "toType") == "field") {
if (rgempty("toField", $notification)) {
$to_field = rgar($notification, "to");
} else {
if (rgempty("to", $notification)) {
$to_field = rgar($notification, "toField");
}
}
}
$email_to = rgar($notification, "to");
//do routing logic if "to" field doesn't have a value (to support legacy notifications what will run routing prior to this method
if (empty($email_to) && rgar($notification, "toType") == "routing") {
$email_to = array();
foreach ($notification["routing"] as $routing) {
$source_field = RGFormsModel::get_field($form, $routing["fieldId"]);
$field_value = RGFormsModel::get_lead_field_value($lead, $source_field);
$is_value_match = RGFormsModel::is_value_match($field_value, $routing["value"], $routing["operator"], $source_field) && !RGFormsModel::is_field_hidden($form, $source_field, array(), $lead);
if ($is_value_match) {
$email_to[] = $routing["email"];
}
}
$email_to = join(",", $email_to);
} else {
if (!empty($to_field)) {
$source_field = RGFormsModel::get_field($form, $to_field);
$email_to = RGFormsModel::get_lead_field_value($lead, $source_field);
}
}
//Running through variable replacement
$to = GFCommon::replace_variables($email_to, $form, $lead, false, false);
$subject = GFCommon::replace_variables(rgar($notification, "subject"), $form, $lead, false, false);
$from = GFCommon::replace_variables(rgar($notification, "from"), $form, $lead, false, false);
$from_name = GFCommon::replace_variables(rgar($notification, "fromName"), $form, $lead, false, false);
$bcc = GFCommon::replace_variables(rgar($notification, "bcc"), $form, $lead, false, false);
$replyTo = GFCommon::replace_variables(rgar($notification, "replyTo"), $form, $lead, false, false);
$message_format = rgempty("message_format", $notification) ? "html" : rgar($notification, "message_format");
$message = GFCommon::replace_variables(rgar($notification, "message"), $form, $lead, false, false, !rgar($notification, "disableAutoformat"), $message_format);
$message = do_shortcode($message);
// allow attachments to be passed as a single path (string) or an array of paths, if string provided, add to array
$attachments = rgar($notification, "attachments");
if (!empty($attachments)) {
$attachments = is_array($attachments) ? $attachments : array($attachments);
} else {
$attachments = array();
}
self::send_email($from, $to, $bcc, $replyTo, $subject, $message, $from_name, $message_format, $attachments);
return compact("to", "from", "bcc", "replyTo", "subject", "message", "from_name", "message_format", "attachments");
}