/** * Html row of a Subscriber in subscriber table */ function alo_em_get_subscriber_table_row($subscriber_id, $row_index = 0, $edit = false, $all_lists = false, $all_langs = false) { if (empty($subscriber_id)) { return false; } $subscriber = alo_em_get_subscriber_by_id($subscriber_id); $html = ""; //$html .= "<tr id=\"subscriber-row-{$subscriber_id}\" class=\"subscriber-row\">\n"; $html .= "<th scope=\"row\" class=\"subscriber-row-index\">" . $row_index . "</th>\n"; $html .= "<td style=\"vertical-align: middle;\">"; $html .= "<input type=\"checkbox\" name=\"subscribers[]\" id=\"subscribers_" . $subscriber_id . "\" value=\"" . $subscriber_id . "\" />\n"; $html .= "</td>\n"; if (get_option('show_avatars')) { $html .= "<td>" . get_avatar($subscriber->email, 30) . " </td>"; } $html .= "<td class=\"subscriber-email\">"; if ($edit) { $html .= "<input type=\"text\" id=\"subscriber-" . $subscriber_id . "-email-new\" name=\"subscriber-" . $subscriber_id . "-email-new\" class=\"subscriber-email-new\" value=\"" . format_to_edit($subscriber->email) . "\" />\n"; } else { $html .= esc_html($subscriber->email); } $html .= " </td>\n"; $html .= "<td class=\"subscriber-name\">"; if ($edit) { $html .= "<input type=\"text\" id=\"subscriber-" . $subscriber_id . "-name-new\" name=\"subscriber-" . $subscriber_id . "-name-new\" class=\"subscriber-name-new\" value=\"" . format_to_edit($subscriber->name) . "\" />\n"; } else { $html .= esc_html($subscriber->name); } $html .= " </td>\n"; //edit : added the following foreach and its content $alo_em_cf = alo_easymail_get_custom_fields(); if ($alo_em_cf) { foreach ($alo_em_cf as $key => $value) { $field_id = "subscriber-" . $subscriber_id . "-" . $key . "-new"; // edit-by-alo: added $html .= "<td class=\"subscriber-" . $key . "-new\">"; // edit-by-alo if ($edit) { $var_value = ""; if (!empty($subscriber->{$key})) { $var_value = $subscriber->{$key}; } // edit-by-alo: added //$html .= sprintf( $value['edit_html'], $subscriber_id, $subscriber_id, format_to_edit( $var_value ) ); $html .= alo_easymail_custom_field_html($key, $value, $field_id, $var_value, true); } else { $var_value = ""; // particular case: empty is a negative checkbox if (empty($subscriber->{$key}) && $value['input_type'] == 'checkbox') { $html .= alo_easymail_custom_field_html($key, $value, $field_id, $var_value, false); } else { if (!empty($subscriber->{$key})) { $var_value = $subscriber->{$key}; $html .= alo_easymail_custom_field_html($key, $value, $field_id, $var_value, false); } else { $html .= ""; } } } $html .= " </td>\n"; } } $html .= "<td>"; $user_id = email_exists($subscriber->email); if (!$user_id) { $user_id = apply_filters('alo_easymail_get_userid_by_subscriber', false, $subscriber); // Hook } if ($user_id) { $user_info = get_userdata($user_id); if (get_current_user_id() == $user_id) { $profile_link = 'profile.php'; } else { $profile_link = esc_url(add_query_arg('wp_http_referer', urlencode(stripslashes($_SERVER['REQUEST_URI'])), "user-edit.php?user_id={$user_id}")); } $html .= "<a href=\"" . $profile_link . "\" title=\"" . esc_attr(__("View user profile", "alo-easymail")) . "\">{$user_info->user_login}</a>"; } $html .= " </td>\n"; $html .= "<td class=\"subscriber-joindate\">\n"; $join_date_datetime = date_i18n(__("d/m/Y \\h.H:i", "alo-easymail"), strtotime($subscriber->join_date)); $join_time_diff = sprintf(__("%s ago", "alo-easymail"), human_time_diff(strtotime($subscriber->join_date), current_time('timestamp'))); //$html .= $join_time_diff ." <img src=\"".ALO_EM_PLUGIN_URL."/images/12-clock.png\" class=\"clock\" title=\"". esc_attr($join_date_datetime) ."\" alt=\"". $join_date_datetime ."\" />\n"; $html .= "<abbr title=\"" . esc_attr($join_date_datetime) . "\" />" . $join_time_diff . "</abbr>\n"; $html .= "</td>\n"; $html .= "<td class=\"subscriber-lastact\">\n"; $last_act = !empty($subscriber->last_act) ? $subscriber->last_act : $subscriber->join_date; $last_act_datetime = date_i18n(__("d/m/Y \\h.H:i", "alo-easymail"), strtotime($last_act)); $last_act_diff = sprintf(__("%s ago", "alo-easymail"), human_time_diff(strtotime($last_act), current_time('timestamp'))); //$last_ip_addr = ' @ IP: '. ( !empty($subscriber->ip_address) ? $subscriber->ip_address : '?' ); //$html .= $last_act_diff ." <img src=\"".ALO_EM_PLUGIN_URL."/images/12-clock.png\" class=\"clock\" title=\"". esc_attr($last_act_datetime . $last_ip_addr) ."\" alt=\"(". $last_act_datetime .")\" />\n"; $html .= "<abbr title=\"" . esc_attr($last_act_datetime) . "\" />" . $last_act_diff . "</abbr>\n"; if (!empty($subscriber->ip_address)) { $last_ip_addr = preg_replace('/[^0-9a-fA-F:., ]/', '', $subscriber->ip_address); $html .= "<br /><a href=\"http://www.whatismyipaddress.com/ip/{$last_ip_addr}\" title=\"" . esc_attr($last_ip_addr . ' @ whatismyipaddress.com') . "\" target=\"_blank\" class=\"ip-address\"/>IP " . $last_ip_addr . "</abbr>\n"; } $html .= "</td>\n"; $html .= "<td class=\"subscriber-active\">\n"; if ($edit) { $active_checked = $subscriber->active == 1 ? " checked=\"checked\" " : ""; $html .= "<input type=\"checkbox\" id=\"subscriber-" . $subscriber_id . "-active-new\" name=\"subscriber-" . $subscriber_id . "-active-new\" class=\"subscriber-active-new\" {$active_checked} />\n"; } else { $html .= "<img src=\"" . ALO_EM_PLUGIN_URL . "/images/" . ($subscriber->active == 1 ? "yes.png" : "no.png") . "\" />\n"; } $html .= "</td>\n"; $html .= "<td class=\"subscriber-lists\">\n"; $user_lists = alo_em_get_user_mailinglists($subscriber_id); if ($edit && is_array($all_lists)) { foreach ($all_lists as $list => $val) { $checked = is_array($user_lists) && in_array($list, $user_lists) ? " checked=\"checked\" " : ""; $html .= "<input type=\"checkbox\" name=\"subscriber-" . $subscriber_id . "-lists-new[]\" class=\"subscriber-lists-new subscriber-" . $subscriber_id . "-lists-new\" id=\"subscriber-" . $subscriber_id . "-lists-new_" . $list . "\" value=\"" . $list . "\" {$checked} /><label for=\"subscriber-" . $subscriber_id . "-lists-new_" . $list . "\">" . alo_em_translate_multilangs_array(alo_em_get_language(), $val['name'], true) . "</label><br />\n"; } } else { if ($user_lists && is_array($user_lists) && $all_lists) { $html .= "<ul class=\"userlists\">\n"; foreach ($user_lists as $user_list) { $html .= "<li>" . alo_em_translate_multilangs_array(alo_em_get_language(), $all_lists[$user_list]["name"], true) . "</li>\n"; } $html .= "</ul>\n"; } } $html .= " </td>\n"; $html .= "<td class=\"subscriber-lang\">\n"; if ($edit && is_array($all_langs) && !empty($all_langs[0])) { $html .= "<select id=\"subscriber-" . $subscriber_id . "-lang-new\" name=\"subscriber-" . $subscriber_id . "-lang-new\">\n"; $html .= "<option value=\"\"></option>\n"; foreach ($all_langs as $key => $val) { $selected = $subscriber->lang == $val ? " selected=\"selected\" " : ""; $lang_name = esc_html(alo_em_get_lang_name($val)); $html .= "<option value=\"" . $val . "\" " . $selected . ">" . $lang_name . "</option>\n"; } $html .= "</select>\n"; } else { $html .= $subscriber->lang ? alo_em_get_lang_flag($subscriber->lang, 'name') : ""; } $html .= " </td>\n"; $html .= "<td class=\"subscriber-actions\">\n"; // Actions $html .= "<img src=\"" . ALO_EM_PLUGIN_URL . "/images/wpspin_light.gif\" style=\"display:none;vertical-align: middle;\" id=\"easymail-subscriber-" . $subscriber_id . "-actions-loading\" />\n"; if ($edit) { $html .= " <a href=\"\" title=\"" . esc_attr(__("Cancel", "alo-easymail")) . "\" class=\"easymail-subscriber-edit-inline-cancel\" id=\"easymail-subscriber-edit-inline-cancel_{$subscriber_id}\" rel=\"{$subscriber_id}\">"; $html .= "<img src=\"" . ALO_EM_PLUGIN_URL . "/images/no.png\" /></a>\n"; $html .= " <a href=\"\" title=\"" . esc_attr(__("Save", "alo-easymail")) . "\" class=\"easymail-subscriber-edit-inline-save\" id=\"easymail-subscriber-edit-inline-save_{$subscriber_id}\" rel=\"{$subscriber_id}\">"; $html .= "<img src=\"" . ALO_EM_PLUGIN_URL . "/images/yes.png\" /></a>\n"; } else { $html .= "<a href=\"\" title=\"" . esc_attr(__("Quick edit", "alo-easymail")) . "\" class=\"easymail-subscriber-edit-inline\" id=\"easymail-subscriber-edit-inline_{$subscriber_id}\" rel=\"{$subscriber_id}\">"; $html .= "<img src=\"" . ALO_EM_PLUGIN_URL . "/images/16-edit.png\" alt=\"" . esc_attr(__("Quick edit", "alo-easymail")) . "\" /></a>"; $html .= " <a href=\"\" title=\"" . esc_attr(__("Delete subscriber", "alo-easymail")) . "\" class=\"easymail-subscriber-delete\" id=\"easymail-subscriber-delete_{$subscriber_id}\" rel=\"{$subscriber_id}\">"; $html .= "<img src=\"" . ALO_EM_PLUGIN_URL . "/images/trash.png\" alt=\"" . esc_attr(__("Delete subscriber", "alo-easymail")) . "\" /></a>"; $html .= " <a href=\"\" title=\"" . esc_attr(__("Delete subscriber and add the email to the list of who unsubscribed", "alo-easymail")) . "\" class=\"easymail-subscriber-delete and-unsubscribe\" id=\"easymail-subscriber-delete-and-unsubscribe_{$subscriber_id}\" rel=\"{$subscriber_id}\">"; $html .= "<img src=\"" . ALO_EM_PLUGIN_URL . "/images/trash_del.png\" alt=\"" . esc_attr(__("Delete subscriber and add the email to the list of who unsubscribed", "alo-easymail")) . "\" /></a>"; } $html .= "</td>\n"; return $html; }
<input type="text" name="elp_list_name" value="<?php if (isset($_REQUEST['task']) && $_REQUEST['task'] == 'edit_list' && $list_id) { echo $list_name; } ?> " id="elp_list_name" size="30" maxlength="50" /> --> <div id="listname_container"> <?php // Set tabs and fields if ($languages) { $lang_li = array(); $lang_div = array(); foreach ($languages as $key => $lang) { $lang_li[$lang] = '<li><a href="#listname_div_' . $lang . '"><strong>' . alo_em_get_lang_flag($lang, 'code') . '</strong>'; $lang_li[$lang] .= isset($_REQUEST['task']) && $_REQUEST['task'] == 'edit_list' && $list_id && !alo_em_translate_multilangs_array($lang, $list_name, false) ? '<img src="' . ALO_EM_PLUGIN_URL . '/images/12-exclamation.png" alt="" style="vertical-align:middle;margin-left:2px;margin-top:-2px;" title="' . __("no translation for this language, yet", "alo-easymail") . '!" />' : ''; $lang_li[$lang] .= '</a></li>'; $lang_div[$lang] = '<div id ="listname_div_' . $lang . '">'; $name_value = isset($_REQUEST['task']) && $_REQUEST['task'] == 'edit_list' && $list_id ? esc_attr(alo_em_translate_multilangs_array($lang, $list_name, false)) : ""; $lang_div[$lang] .= '<input type="text" name="listname_' . $lang . '" value="' . $name_value . '" id="listname_' . $lang . '" maxlength="100" style="width:100%;" />'; $lang_div[$lang] .= '</div>'; } } ?> <ul id="activamail_tabs"> <?php echo implode("\n\n", $lang_li); ?> </ul>
?> </th> </tr> </thead> <tbody> <?php $class = ""; $n = $offset; foreach ($recipients as $recipient) { $class = '' == $class ? "style='background-color:#eee;'" : ""; $n++; echo "<tr {$class} ><td>" . $n . "</td><td>" . $recipient->email . "</td><td>" . $recipient->name . "</td>"; echo "<td class='center'>"; if (isset($recipient->lang)) { echo alo_em_get_lang_flag($recipient->lang, 'name'); } echo "</td>"; echo "<td class='center'>" . ($recipient->result == "1" ? __("Yes", "alo-easymail") : __("No", "alo-easymail")) . " <img src='" . ALO_EM_PLUGIN_URL . "/images/" . ($recipient->result == "1" ? "yes.png" : "no.png") . "' alt='" . ($recipient->result == "1" ? __("Yes", "alo-easymail") : __("No", "alo-easymail")) . "' />"; if ($recipient->result == "-3") { echo " <img src='" . ALO_EM_PLUGIN_URL . "/images/16-email-bounce.png' alt='" . esc_attr(__("Bounced", "alo-easymail")) . "' title='" . esc_attr(__("Bounced", "alo-easymail") . ': ' . __("the message was rejected by recipient mail server", "alo-easymail")) . "' />"; } echo "</td>"; echo "<td class='center'>"; echo ($recipient->result == "1" && alo_em_recipient_is_tracked($recipient->ID, '') ? __("Yes", "alo-easymail") : __("No", "alo-easymail")) . " <img src='" . ALO_EM_PLUGIN_URL . "/images/" . ($recipient->result == "1" && alo_em_recipient_is_tracked($recipient->ID, '') ? "yes.png" : "no.png") . "' />"; if (count(alo_em_get_recipient_trackings($recipient->ID, '')) > 1) { echo " " . count(alo_em_get_recipient_trackings($recipient->ID, '')); } echo "</td>"; echo "<td class='center'>"; echo ($recipient->result == "1" && alo_em_get_recipient_trackings_except_views($recipient->ID) ? __("Yes", "alo-easymail") : __("No", "alo-easymail")) . " <img src='" . ALO_EM_PLUGIN_URL . "/images/" . ($recipient->result == "1" && alo_em_get_recipient_trackings_except_views($recipient->ID) ? "yes.png" : "no.png") . "' />";