/** * Creates the stats page */ function inboundrocket_build_lead_list_page() { global $wp_version; if (isset($_POST['tag_name'])) { $list_id = isset($_POST['list_id']) ? absint($_POST['list_id']) : FALSE; $tagger = new IR_Lead_List_Editor($list_id); $tag_name = sanitize_text_field($_POST['tag_name']); $tag_form_selectors = ''; $tag_synced_lists = array(); foreach ($_POST as $name => $value) { // Create a comma deliniated list of selectors for tag_form_selectors if (strstr($name, 'email_form_tags_')) { $tag_selector = ''; if (strstr($name, '_class')) { $tag_selector = str_replace('email_form_tags_class_', '.', $name); } else { if (strstr($name, '_id')) { $tag_selector = str_replace('email_form_tags_id_', '#', $name); } } if ($tag_selector) { if (!strstr($tag_form_selectors, $tag_selector)) { $tag_form_selectors .= $tag_selector . ','; } } } else { if (strstr($name, 'email_connect_')) { // Name comes through as email_connect_espslug_listid, so replace the beginning of each one with corresponding esp slug, which leaves just the list id if (strstr($name, '_mailchimp')) { $synced_list = array('esp' => 'mailchimp', 'list_id' => str_replace('email_connect_mailchimp_', '', $name), 'list_name' => $value); } else { if (strstr($name, '_constant_contact')) { $synced_list = array('esp' => 'constant_contact', 'list_id' => str_replace('email_connect_constant_contact_', '', $name), 'list_name' => $value); } else { if (strstr($name, '_aweber')) { $synced_list = array('esp' => 'aweber', 'list_id' => str_replace('email_connect_aweber_', '', $name), 'list_name' => $value); } else { if (strstr($name, '_campaign_monitor')) { $synced_list = array('esp' => 'campaign_monitor', 'list_id' => str_replace('email_connect_campaign_monitor_', '', $name), 'list_name' => $value); } else { if (strstr($name, '_getresponse')) { $synced_list = array('esp' => 'getresponse', 'list_id' => str_replace('email_connect_getresponse_', '', $name), 'list_name' => $value); } } } } } array_push($tag_synced_lists, $synced_list); } } } if ($_POST['email_form_tags_custom']) { if (strstr($_POST['email_form_tags_custom'], ',')) { foreach (explode(',', sanitize_text_field($_POST['email_form_tags_custom'])) as $tag) { if (!strstr($tag_form_selectors, $tag)) { $tag_form_selectors .= $tag . ','; } } } else { if (!strstr($tag_form_selectors, sanitize_text_field($_POST['email_form_tags_custom']))) { $tag_form_selectors .= sanitize_text_field($_POST['email_form_tags_custom']) . ','; } } } // Sanitize the selectors by removing any spaces and any trailing commas $tag_form_selectors = rtrim(str_replace(' ', '', $tag_form_selectors), ','); if ($list_id) { $tagger->save_list($list_id, $tag_name, $tag_form_selectors, serialize($tag_synced_lists)); } else { $tagger->list_id = $tagger->add_list($tag_name, $tag_form_selectors, serialize($tag_synced_lists)); } } echo '<div id="inboundrocket" class="wrap ' . ($wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? 'pre-mp6' : '') . '">'; if ($this->action == 'edit_list' || $this->action == 'add_list') { inboundrocket_track_plugin_activity("Loaded Lead List Editor"); $this->inboundrocket_render_tag_editor(); } else { inboundrocket_track_plugin_activity("Loaded Lead List List"); $this->inboundrocket_render_tag_list_page(); } $this->inboundrocket_footer(); echo '</div>'; }