give_get_forms_label_singular(), // Singular name of the listed records. 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. 'ajax' => false,// Does this table support ajax?. ) ); } /** * This function renders most of the columns in the list table. * * @access public * @since 1.0 * * @param array $item Contains all the data of the log item. * @param string $column_name The name of the column. * * @return string Column Name. */ public function column_default( $item, $column_name ) { switch ( $column_name ) { case 'ID' : return $item['ID_label']; case 'payment_id' : return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "{$item['payment_id']}", get_edit_post_link( $item['payment_id'] ) ); case 'gateway' : return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway']; case 'error' : return esc_html( $item['log_title'] ); default: return $item[ $column_name ]; } } /** * Output Error Message Column. * * @access public * @since 1.0 * * @param array $item Contains all the data of the log. * * @return void */ public function column_message( $item ) { ?> tooltips->render_link( array( 'label' => __( 'View Log Message', 'give' ), 'tag_content' => '', 'link' => "#TB_inline?width=640&inlineId=log-message-{$item['ID']}", 'attributes' => array( 'class' => 'thickbox give-error-log-details-link button button-small', ), ) ); ?>
esc_html__( 'Log ID', 'give' ), 'error' => esc_html__( 'Error', 'give' ), 'gateway' => esc_html__( 'Gateway', 'give' ), 'payment_id' => esc_html__( 'Donation ID', 'give' ), 'date' => esc_html__( 'Date', 'give' ), 'message' => esc_html__( 'Details', 'give' ), ); return $columns; } /** * Retrieve the current page number * * @access public * @since 1.0 * @return int Current page number */ public function get_paged() { return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; } /** * Outputs the log views * * @access public * @since 1.0 * @return void */ public function bulk_actions( $which = '' ) { give_log_views(); } /** * Gets the log entries for the current view. * * @access public * @since 1.0 * * @return array $logs_data Array of all the Log entries. */ public function get_logs() { // Prevent the queries from getting cached. // Without this there are occasional memory issues for some installs. wp_suspend_cache_addition( true ); $logs_data = array(); $paged = $this->get_paged(); $log_query = array( 'log_type' => 'gateway_error', 'paged' => $paged, 'posts_per_page' => $this->per_page, ); $logs = Give()->logs->get_connected_logs( $log_query ); if ( $logs ) { foreach ( $logs as $log ) { $logs_data[] = array( 'ID' => $log->ID, 'ID_label' => '' . $log->ID . '', 'payment_id' => $log->log_parent, 'error' => 'error', 'gateway' => give_get_payment_gateway( $log->log_parent ), 'date' => $log->log_date, 'log_content' => $log->log_content, 'log_title' => $log->log_title, ); } } return $logs_data; } /** * Display Tablenav (extended). * * Display the table navigation above or below the table even when no items in the logs, * so nav doesn't disappear. * * @see : https://github.com/impress-org/give/issues/564 * * @since 1.4.1 * @access protected * * @param string $which */ protected function display_tablenav( $which ) { if ( 'top' === $which ) { wp_nonce_field( 'bulk-' . $this->_args['plural'] ); } ?>