芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/public_html/wp-content/plugins/chaty/views/admin/contact-form-feed.php
* @license : GPL2 * */ if (defined('ABSPATH') === false) { exit; } global $wpdb; $tableName = $wpdb->prefix.'chaty_contact_form_leads'; $paged = filter_input(INPUT_GET, 'paged'); $current = isset($paged)&&!empty($paged)&&is_numeric($paged)&&$paged > 0 ? $paged : 1; $current = intval($current); $searchFor = "all_time"; $searchList = [ 'today' => esc_html__('Today', 'chaty'), 'yesterday' => esc_html__('Yesterday', 'chaty'), 'last_7_days' => esc_html__('Last 7 Days', 'chaty'), 'last_30_days' => esc_html__('Last 30 Days', 'chaty'), 'this_week' => esc_html__('This Week', 'chaty'), 'this_month' => esc_html__('This Month', 'chaty'), 'all_time' => esc_html__('All Time', 'chaty'), 'custom' => esc_html__('Custom Date', 'chaty') ]; $searchFor = filter_input(INPUT_GET, 'search_for'); if (isset($searchFor) && !empty($searchFor) && isset($searchList[$searchFor])) { $searchFor = esc_attr($searchFor); } else { $searchFor = "all_time"; } $startDate = ""; $endDate = ""; if ($searchFor == "today") { $startDate = gmdate("Y-m-d"); $endDate = gmdate("Y-m-d"); } else if ($searchFor == "yesterday") { $startDate = gmdate("Y-m-d", strtotime("-1 days")); $endDate = gmdate("Y-m-d", strtotime("-1 days")); } else if ($searchFor == "last_7_days") { $startDate = gmdate("Y-m-d", strtotime("-7 days")); $endDate = gmdate("Y-m-d"); } else if ($searchFor == "last_30_days") { $startDate = gmdate("Y-m-d", strtotime("-30 days")); $endDate = gmdate("Y-m-d"); } else if ($searchFor == "this_week") { $startDate = gmdate("Y-m-d", strtotime('monday this week')); $endDate = gmdate("Y-m-d"); } else if ($searchFor == "this_month") { $startDate = gmdate("Y-m-01"); $endDate = gmdate("Y-m-d"); } else if ($searchFor == "custom") { $startDate = filter_input(INPUT_GET, 'start_date'); if (!empty($startDate)) { $startDate = esc_attr($startDate); } else { $startDate = ""; } $endDate = filter_input(INPUT_GET, 'end_date'); if (!empty($endDate)) { $endDate = esc_attr($endDate); } else { $endDate = ""; } }//end if $hasSearch = filter_input(INPUT_GET, 'search'); $hasSearch = isset($hasSearch)&&!empty($hasSearch) ? $hasSearch : false; $query = "SELECT count(id) as total_records FROM ".$tableName; $search = ""; $condition = ""; $conditionArray = []; if ($hasSearch !== false) { $search = $hasSearch; $hasSearch = '%'.esc_sql($hasSearch).'%'; $condition .= " (name LIKE %s OR email LIKE %s OR phone_number LIKE %s OR message LIKE %s)"; $conditionArray[] = $hasSearch; $conditionArray[] = $hasSearch; $conditionArray[] = $hasSearch; $conditionArray[] = $hasSearch; } $startDate = esc_attr($startDate); $endDate = esc_attr($endDate); if (!empty($startDate) && !empty($endDate)) { if (!empty($condition)) { $condition .= " AND "; } $cStartDate = gmdate("Y-m-d 00:00:00", strtotime($startDate)); $cEndDate = gmdate("Y-m-d 23:59:59", strtotime($endDate)); $condition .= " created_on >= %s AND created_on <= %s"; $conditionArray[] = $cStartDate; $conditionArray[] = $cEndDate; } if (!empty($condition)) { $query .= " WHERE ".$condition; } $query .= " ORDER BY ID DESC"; if (!empty($conditionArray)) { $query = $wpdb->prepare($query, $conditionArray); } $totalRecords = $wpdb->get_var($query); $perPage = 15; $totalPages = ceil($totalRecords / $perPage); $query = "SELECT * FROM ".$tableName; if (!empty($condition)) { $query .= " WHERE ".$condition; } if ($current > $totalPages) { $current = 1; } $startFrom = (($current - 1) * $perPage); $query .= " ORDER BY ID DESC"; $query .= " LIMIT $startFrom, $perPage"; if (!empty($conditionArray)) { $query = $wpdb->prepare($query, $conditionArray); } ?>
get_results($query); ?>
" >
" method="get">
$value) { ?>
value="">
">
">
widget_id == 0) { $widgetName = "Default"; } else { $widgetName = get_option("cht_widget_title_".$res->widget_id); if (empty($widgetName)) { $widgetName = "Widget #".($res->widget_id + 1); } } $socialIcons = get_option('cht_social_Contact_Us'); ?>
id) ?>
name)) ?>
email)) ?>
phone_number)) ?>
message))) ?>
ip_address))); } else { echo ""; } ?>
created_on) ?>
1) { $baseURL = admin_url("admin.php?paged=%#%&page=chaty-contact-form-feed"); if (!empty($search)) { $baseURL .= "&search=".esc_attr($search); } echo '
'; echo paginate_links( [ 'base' => $baseURL, 'total' => $totalPages, 'current' => $current, 'format' => '?paged=%#%', 'show_all' => false, 'type' => 'list', 'end_size' => 3, 'mid_size' => 1, 'prev_next' => true, 'prev_text' => sprintf('%1$s', '
'), 'next_text' => sprintf('%1$s', '
'), 'add_args' => false, 'add_fragment' => '', ] ); echo "
"; }//end if ?>
" class="btn rounded-lg inline-block" id="wpappp_export_to_csv" value="Export to CSV">
" />
">