/** * Responsible for sending the actual email */ public static function send_email($data_context, $address, $subject_tmpl_file, $message_tmpl_file, $attachment) { // Load the subject and message templates $message_tmpl = file_get_contents(dirname(dirname(dirname(__FILE__))) . '/email_templates/' . $message_tmpl_file); $subject_tmpl = file_get_contents(dirname(dirname(dirname(__FILE__))) . '/email_templates/' . $subject_tmpl_file); // Fill the templates $message_tmpl = EntityStringUtils::parse($message_tmpl, $data_context); $subject_tmpl = EntityStringUtils::parse($subject_tmpl, $data_context); LogUtils::shadow_log($data_context); LogUtils::shadow_log('Sending mail to ' . $address . ' with subject ' . $subject_tmpl); // Send the email wp_mail($address, $subject_tmpl, $message_tmpl, '', $attachment); }
/** * */ public static function do_edit_person($entity_data, $party_data) { $entity_data['edit_mode'] = 0; LogUtils::shadow_log($entity_data); if (!isset($entity_data['name'])) { $entity_data['name'] = $party_data['name']; } if (!isset($entity_data['description'])) { $entity_data['description'] = $party_data['description']; } $entity_data = EntityAPI::do_create_entity($entity_data); return $entity_data; }
/** * */ public static function build_criteria_from_form_data($entity_data) { $criteria_data = array(); /*if(isset($_POST['bcat'])) { $category_data = EntityAPI::get_by_code( 'businesscategory', array('entity_code' => strtoupper(sanitize_text_field($_POST['cat'])))); if(isset($category_data['id'])) $criteria_data['type.category'] = $category_data['id']; }*/ // Process global search if (!EntityStringUtils::is_invalid_string($_POST['search']['value'])) { $criteria_data['is_global'] = true; $criteria_data['search'] = sanitize_text_field($_POST['search']['value']); } else { if (isset($_POST['columns'])) { $columns_data = $_POST['columns']; foreach ($columns_data as $column_data) { $column_name = sanitize_text_field($column_data['data']); if (EntityStringUtils::ends_with($column_name, '_txt')) { $column_name = str_replace('_txt', '', $column_name); } if (array_key_exists($column_name, $entity_data['entity_fields'])) { if (isset($column_data['search'])) { if (!EntityStringUtils::is_invalid_string($column_data['search']['value'])) { $field_value = sanitize_text_field($column_data['search']['value']); $criteria_data[$column_name] = $field_value; } } } } LogUtils::shadow_log('Doing global'); foreach ($entity_data['entity_fields'] as $field_name => $field_data) { if (isset($_POST[$field_data['name']])) { LogUtils::shadow_log('Doing global1'); $criteria_data[$field_data['name']] = sanitize_text_field($_POST[$field_data['name']]); } } } else { if (isset($_POST['form'])) { if (isset($_POST['form'][3])) { $criteria_data[$_POST['form'][3]['name']] = $_POST['form'][3]['value']; } } } } return $criteria_data; }