'', 'title' => __( 'Title', 'contact-form-7' ), 'shortcode' => __( 'Shortcode', 'contact-form-7' ), 'author' => __( 'Author', 'contact-form-7' ), 'date' => __( 'Date', 'contact-form-7' ), ); return $columns; } function __construct() { parent::__construct( array( 'singular' => 'post', 'plural' => 'posts', 'ajax' => false, ) ); } function prepare_items() { $current_screen = get_current_screen(); $per_page = $this->get_items_per_page( 'cfseven_contact_forms_per_page' ); $this->_column_headers = $this->get_column_info(); $args = array( 'posts_per_page' => $per_page, 'orderby' => 'title', 'order' => 'ASC', 'offset' => ( $this->get_pagenum() - 1 ) * $per_page, ); if ( ! empty( $_REQUEST['s'] ) ) { $args['s'] = $_REQUEST['s']; } if ( ! empty( $_REQUEST['orderby'] ) ) { if ( 'title' == $_REQUEST['orderby'] ) { $args['orderby'] = 'title'; } elseif ( 'author' == $_REQUEST['orderby'] ) { $args['orderby'] = 'author'; } elseif ( 'date' == $_REQUEST['orderby'] ) { $args['orderby'] = 'date'; } } if ( ! empty( $_REQUEST['order'] ) ) { if ( 'asc' == strtolower( $_REQUEST['order'] ) ) { $args['order'] = 'ASC'; } elseif ( 'desc' == strtolower( $_REQUEST['order'] ) ) { $args['order'] = 'DESC'; } } $this->items = WPCF7_ContactForm::find( $args ); $total_items = WPCF7_ContactForm::count(); $total_pages = ceil( $total_items / $per_page ); $this->set_pagination_args( array( 'total_items' => $total_items, 'total_pages' => $total_pages, 'per_page' => $per_page, ) ); } function get_columns() { return get_column_headers( get_current_screen() ); } function get_sortable_columns() { $columns = array( 'title' => array( 'title', true ), 'author' => array( 'author', false ), 'date' => array( 'date', false ), ); return $columns; } function get_bulk_actions() { $actions = array( 'delete' => __( 'Delete', 'contact-form-7' ), ); return $actions; } function column_default( $item, $column_name ) { return ''; } function column_cb( $item ) { return sprintf( '', $this->_args['singular'], $item->id() ); } function column_title( $item ) { $url = admin_url( 'admin.php?page=wpcf7&post=' . absint( $item->id() ) ); $edit_link = add_query_arg( array( 'action' => 'edit' ), $url ); $output = sprintf( '%3$s', esc_url( $edit_link ), esc_attr( sprintf( __( 'Edit “%s”', 'contact-form-7' ), $item->title() ) ), esc_html( $item->title() ) ); $output = sprintf( '%s', $output ); if ( wpcf7_validate_configuration() && current_user_can( 'wpcf7_edit_contact_form', $item->id() ) ) { $config_validator = new WPCF7_ConfigValidator( $item ); $config_validator->restore(); if ( $count_errors = $config_validator->count_errors() ) { $error_notice = sprintf( _n( '%s configuration error detected', '%s configuration errors detected', $count_errors, 'contact-form-7' ), number_format_i18n( $count_errors ) ); $output .= sprintf( '