src/WooCommerce/Shop/InvoiceStatusOverviewForm.php
private function sanitizeEntry($entry)
    {
        if (!empty($entry)) {
            /* @todo: keys in $entry array that are not yet used and not yet sanitized:
             *   - entrytype
             *   - entrydescription
             *   - entrynote
             *   - fiscaltype
             *   - contactid
             *   - accountnumber
             *   - costcenterid
             *   - costtypeid
             *   - invoicenote
             *   - descriptiontext
             *   - invoicelayoutid
             *   - token
             *   - paymenttermdays
             */
            $result['entryid'] = $this->sanitizeEntryIntValue($entry, 'entryid');
            $result['entrydate'] = $this->sanitizeEntryDateValue($entry, 'entrydate');
            $result['vatreversecharge'] = $this->sanitizeEntryBoolValue($entry, 'vatreversecharge');
            $result['foreigneu'] = $this->sanitizeEntryBoolValue($entry, 'foreigneu');
            $result['foreignnoneu'] = $this->sanitizeEntryBoolValue($entry, 'foreignnoneu');
            $result['marginscheme'] = $this->sanitizeEntryBoolValue($entry, 'marginscheme');
            $result['foreignvat'] = $this->sanitizeEntryBoolValue($entry, 'foreignvat');
            $result['invoicenumber'] = $this->sanitizeEntryIntValue($entry, 'invoicenumber');
            $result['totalvalueexclvat'] = $this->sanitizeEntryFloatValue($entry, 'totalvalueexclvat');
            $result['totalvalue'] = $this->sanitizeEntryFloatValue($entry, 'totalvalue');
            $result['paymentstatus'] = $this->sanitizeEntryIntValue($entry, 'paymentstatus');
            $result['paymentdate'] = $this->sanitizeEntryDateValue($entry, 'paymentdate');
            $result['deleted'] = $this->sanitizeEntryStringValue($entry, 'deleted');
        } else {
            $result = null;
        }
        return $result;
    }
private function sanitizeEntry($entry)
    {
        if (!empty($entry)) {
            /* @todo: keys in $entry array that are not yet used and not yet sanitized:
             *   - entrytype
             *   - entrydescription
             *   - entrynote
             *   - fiscaltype
             *   - contactid
             *   - accountnumber
             *   - costcenterid
             *   - costtypeid
             *   - invoicenote
             *   - descriptiontext
             *   - invoicelayoutid
             *   - token
             *   - paymenttermdays
             */
            $result['entryid'] = $this->sanitizeEntryIntValue($entry, 'entryid');
            $result['entrydate'] = $this->sanitizeEntryDateValue($entry, 'entrydate');
            $result['vatreversecharge'] = $this->sanitizeEntryBoolValue($entry, 'vatreversecharge');
            $result['foreigneu'] = $this->sanitizeEntryBoolValue($entry, 'foreigneu');
            $result['foreignnoneu'] = $this->sanitizeEntryBoolValue($entry, 'foreignnoneu');
            $result['marginscheme'] = $this->sanitizeEntryBoolValue($entry, 'marginscheme');
            $result['foreignvat'] = $this->sanitizeEntryBoolValue($entry, 'foreignvat');
            $result['invoicenumber'] = $this->sanitizeEntryIntValue($entry, 'invoicenumber');
            $result['totalvalueexclvat'] = $this->sanitizeEntryFloatValue($entry, 'totalvalueexclvat');
            $result['totalvalue'] = $this->sanitizeEntryFloatValue($entry, 'totalvalue');
            $result['paymentstatus'] = $this->sanitizeEntryIntValue($entry, 'paymentstatus');
            $result['paymentdate'] = $this->sanitizeEntryDateValue($entry, 'paymentdate');
            $result['deleted'] = $this->sanitizeEntryStringValue($entry, 'deleted');
        } else {
            $result = null;
        }
        return $result;
    }
private function sanitizeEntry ( $ entry ) { if ( ! empty ( $ entry ) ) { /* @todo: keys in $entry array that are not yet used and not yet sanitized:
             *   - entrytype
             *   - entrydescription
             *   - entrynote
             *   - fiscaltype
             *   - contactid
             *   - accountnumber
             *   - costcenterid
             *   - costtypeid
             *   - invoicenote
             *   - descriptiontext
             *   - invoicelayoutid
             *   - token
             *   - paymenttermdays
             */ $ result [ 'entryid' ] = $ this -> sanitizeEntryIntValue ( $ entry , 'entryid' ) ; $ result [ 'entrydate' ] = $ this -> sanitizeEntryDateValue ( $ entry , 'entrydate' ) ; $ result [ 'vatreversecharge' ] = $ this -> sanitizeEntryBoolValue ( $ entry , 'vatreversecharge' ) ; $ result [ 'foreigneu' ] = $ this -> sanitizeEntryBoolValue ( $ entry , 'foreigneu' ) ; $ result [ 'foreignnoneu' ] = $ this -> sanitizeEntryBoolValue ( $ entry , 'foreignnoneu' ) ; $ result [ 'marginscheme' ] = $ this -> sanitizeEntryBoolValue ( $ entry , 'marginscheme' ) ; $ result [ 'foreignvat' ] = $ this -> sanitizeEntryBoolValue ( $ entry , 'foreignvat' ) ; $ result [ 'invoicenumber' ] = $ this -> sanitizeEntryIntValue ( $ entry , 'invoicenumber' ) ; $ result [ 'totalvalueexclvat' ] = $ this -> sanitizeEntryFloatValue ( $ entry , 'totalvalueexclvat' ) ; $ result [ 'totalvalue' ] = $ this -> sanitizeEntryFloatValue ( $ entry , 'totalvalue' ) ; $ result [ 'paymentstatus' ] = $ this -> sanitizeEntryIntValue ( $ entry , 'paymentstatus' ) ; $ result [ 'paymentdate' ] = $ this -> sanitizeEntryDateValue ( $ entry , 'paymentdate' ) ; $ result [ 'deleted' ] = $ this -> sanitizeEntryStringValue ( $ entry , 'deleted' ) ; } else { $ result = null ; } return $ result ; }
Sanitizes an entry struct received via an getEntry API call.

The info received from an external API call must not be trusted, so it
should be sanitized. As most info from this API call is placed in markup
fields we cannot rely on the FormRenderer or the webshop's form API
(which do not sanitize markup fields).

So we sanitize the values in the struct itself before using them:
- Int, float, and bool fields are cast to their proper type.
- Date strings are parsed to a DateTime and formatted back to a date
string.
- Strings that can only contain a restricted set of values are checked
against that set and emptied if not part of it.
- Free string values are escaped to save html.
- Keys we don't use are not returned. This keeps the output safe when a
future API version returns additional fields and we forget to sanitize
it and thus use it non sanitised.

@param $entry

@return mixed
The sanitized entry struct.
Sanitizes an entry struct received via an getEntry API call .