'visit', 'plural' => 'visits', ) ); } /** * Columns. * * @return array */ public function get_columns() { return $this->extend_columns( array( 'id' => __( 'ID', 'affireo-affiliates-for-woocommerce' ), 'affiliate' => __( 'Affiliate', 'affireo-affiliates-for-woocommerce' ), 'landing' => __( 'Landing page', 'affireo-affiliates-for-woocommerce' ), 'referrer' => __( 'Referrer', 'affireo-affiliates-for-woocommerce' ), 'device' => __( 'Device', 'affireo-affiliates-for-woocommerce' ), 'ip' => __( 'IP', 'affireo-affiliates-for-woocommerce' ), 'converted' => __( 'Converted', 'affireo-affiliates-for-woocommerce' ), 'created' => __( 'Date', 'affireo-affiliates-for-woocommerce' ), ) ); } /** * Loads rows. */ public function prepare_items() { $result = $this->container->get( 'visits.repository' )->query( array( 'affiliate_id' => absint( $this->get_filter( 'affiliate_id' ) ), 'converted' => $this->get_filter( 'converted' ), 'page' => $this->current_page(), 'per_page' => $this->per_page, ) ); $this->items = $result['rows']; $this->set_pagination_args( array( 'total_items' => $result['total'], 'per_page' => $this->per_page, ) ); $this->_column_headers = array( $this->get_columns(), array(), array() ); } /** * Filter dropdown. * * @param string $which top or bottom. */ protected function extra_tablenav( $which ) { if ( 'top' !== $which ) { return; } $converted = $this->get_filter( 'converted' ); ?>
id; case 'affiliate': return $this->affiliate_label( (int) $item->affiliate_id ); case 'landing': return esc_html( $item->landing_page ); case 'referrer': return $item->referrer_url ? esc_html( wp_parse_url( $item->referrer_url, PHP_URL_HOST ) ?: $item->referrer_url ) : '-'; case 'device': return esc_html( $item->device_type ); case 'ip': return $item->ip_display ? '' . esc_html( $item->ip_display ) . '' : '-'; case 'converted': return $item->converted ? $this->order_link( (int) $item->order_id ) : '-'; case 'created': return esc_html( mysql2date( get_option( 'date_format' ) . ' H:i', $item->created_at ) ); } return $this->extra_column( $item, $column_name ); } }