Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/hopeinstoughton_www/wp-content/plugins/form-wizard/ |
Upload File : |
<?php
class FormWizard_Responses_List_Table extends WP_List_Table {
private $x_formid;
private $x_email_fieldname;
function __construct(){
global $status, $page;
//Set parent defaults
parent::__construct( array(
'singular' => 'response', //singular name of the listed records
'plural' => 'responses', //plural name of the listed records
'ajax' => false //does this table support ajax?
) );
}
function column_default($item, $column_name){
global $listen_live;
$value = isset($item[$column_name]) ? $item[$column_name] : '';
switch($column_name){
case 'fs_timestamp':
if (class_exists('listen_live_class')) {
$bias = 0;
$listen_live->GetTZinfo($value, $bias);
$value += $bias; // adjust for timezone and dls
$value = gmdate('Y-m-d H:i', $value);
} else {
$value = date('Y-m-d H:i', $value);
}
return $value;
case 'fs_ip':
if (strpos($value, ',') !== FALSE) {
$value = explode(',', $value);
$value = trim(array_pop($value));
}
return $value;
case 'fs_country':
case 'fs_akismet':
return $value;
case 'email':
$extra = unserialize($item['fs_data']);
if ($this->x_email_fieldname != '') {
$value = isset($extra[$this->x_email_fieldname]) ? $extra[$this->x_email_fieldname] : '';
} else {
$value = '';
}
return $value;
default:
return print_r($item,true); //Show the whole array for troubleshooting purposes
}
}
/** ************************************************************************
* @see WP_List_Table::::single_row_columns()
* @param array $item A singular item (one full row's worth of data)
* @return string Text to be placed inside the column <td>
**************************************************************************/
function column_fs_timestamp($item){
//Build row actions
$actions = array();
$value = $this->column_default($item, 'fs_timestamp');
//Return the title contents
return sprintf('<a class="row-title" href="?page=form-wizard-item&id=%s" target="tdmsitem">%s</a>',
$item['fs_id'],
/*$1%s*/ $value);
}
/** ************************************************************************
* REQUIRED if displaying checkboxes or using bulk actions! The 'cb' column
* is given special treatment when columns are processed. It ALWAYS needs to
* have it's own method.
*
* @see WP_List_Table::::single_row_columns()
* @param array $item A singular item (one full row's worth of data)
* @return string Text to be placed inside the column <td> (movie title only)
**************************************************************************/
function column_cb($item){
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
/*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("movie")
/*$2%s*/ $item['id'] //The value of the checkbox should be the record's id
);
}
/** ************************************************************************
* REQUIRED! This method dictates the table's columns and titles. This should
* return an array where the key is the column slug (and class) and the value
* is the column's title text. If you need a checkbox for bulk actions, refer
* to the $columns array below.
*
* The 'cb' column is treated differently than the rest. If including a checkbox
* column in your table you must create a column_cb() method. If you don't need
* bulk actions or checkboxes, simply leave the 'cb' entry out of your array.
*
* @see WP_List_Table::::single_row_columns()
* @return array An associative array containing column information: 'slugs'=>'Visible Titles'
**************************************************************************/
function get_columns(){
$columns = array(
'fs_timestamp' => 'Date',
'fs_ip' => 'IP Address',
'fs_country' => 'Ctry',
'fs_akismet' => 'Spam?',
'email' => 'E-mail',
);
return $columns;
}
function get_sortable_columns() {
return array(
'fs_timestamp' => array('fs_timestamp',true), //true means it's already sorted
'fs_country' => array('fs_country',false),
'fs_akismet' => array('fs_akismet',false),
'email' => array('email', false),
);
}
function get_bulk_actions() {
$actions = array(
);
return $actions;
}
/** ************************************************************************
* Optional. You can handle your bulk actions anywhere or anyhow you prefer.
* For this example package, we will handle it in the class to keep things
* clean and organized.
*
* @see $this->prepare_items()
**************************************************************************/
function process_bulk_action() {
}
function SetParam($formid, $email_fieldname) {
$this->x_formid = $formid;
$this->x_email_fieldname = $email_fieldname;
}
/** ************************************************************************
* REQUIRED! This is where you prepare your data for display. This method will
* usually be used to query the database, sort and filter the data, and generally
* get it ready to be displayed. At a minimum, we should set $this->items and
* $this->set_pagination_args(), although the following properties and methods
* are frequently interacted with here...
*
* @global WPDB $wpdb
* @uses $this->_column_headers
* @uses $this->items
* @uses $this->get_columns()
* @uses $this->get_sortable_columns()
* @uses $this->get_pagenum()
* @uses $this->set_pagination_args()
**************************************************************************/
function prepare_items() {
global $wpdb;
$formid = intval($this->x_formid);
$per_page = 20;
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
$this->process_bulk_action();
$query = 'select fs_id,fs_data,fs_timestamp,fs_akismet,fs_ip,fs_country from ' . $wpdb->prefix . 'formwizard_submissions'.
" where fs_form=$formid order by fs_timestamp desc limit 400";
$data = $wpdb->get_results($query, ARRAY_A);
usort($data, array($this, 'usort_reorder'));
$current_page = $this->get_pagenum();
$total_items = count($data);
$this->items = array_slice($data,(($current_page-1)*$per_page),$per_page);
$this->set_pagination_args( array(
'total_items' => $total_items,
'per_page' => $per_page,
'total_pages' => ceil($total_items/$per_page)
) );
}
function usort_reorder($a,$b){
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'fs_timestamp'; //If no sort, default to title
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'desc'; //If no order, default to asc
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
return ($order==='asc') ? $result : -$result; //Send final sort direction to usort
}
}