prefix}redirection_404"; } /** * Create a 404 log entry * * @param string $domain Domain name of request. * @param string $url URL of request. * @param string $ip IP of client. * @param array $details Other log details. * @return int|false Log ID, or false */ public static function create( $domain, $url, $ip, array $details ) { global $wpdb; $insert = static::sanitize_create( $domain, $url, $ip, $details ); $insert = apply_filters( 'redirection_404_data', $insert ); if ( $insert ) { do_action( 'redirection_404', $insert ); $wpdb->insert( $wpdb->prefix . 'redirection_404', $insert ); if ( $wpdb->insert_id ) { return $wpdb->insert_id; } } return false; } /** * Get the CSV filename for this log object * * @return string */ public static function get_csv_filename() { return 'redirection-404'; } /** * Get the CSV headers for this log object * * @return array */ public static function get_csv_header() { return [ 'date', 'source', 'ip', 'referrer', 'useragent' ]; } /** * @return array */ protected static function get_export_field_labels() { return [ 'date' => 'date', 'method' => 'method', 'domain' => 'domain', 'url' => 'source', 'code' => 'code', 'referrer' => 'referrer', 'agent' => 'useragent', 'ip' => 'ip', 'count' => 'count', ]; } /** * Get the CSV row for this log object * * @param object $row Log row. * @return array */ public static function get_csv_row( $row ) { /** @var Log404Row $row */ // Raw values are returned here. Formula escaping is applied by Red_Log's CSV writers. return [ (string) $row->created, (string) $row->url, (string) $row->ip, (string) $row->referrer, (string) $row->agent, ]; } }