Helper/Bibtex.php
function _validateValue($entry, $wholeentry)
    {
        //There is no @ allowed if the entry is enclosed by braces
        if (preg_match('/^{.*@.*}$/', $entry)) {
            $this->_generateWarning('WARNING_AT_IN_BRACES', $entry, $wholeentry);
        }
        //No escaped " allowed if the entry is enclosed by double quotes
        if (preg_match('/^\".*\\".*\"$/', $entry)) {
            $this->_generateWarning('WARNING_ESCAPED_DOUBLE_QUOTE_INSIDE_DOUBLE_QUOTES', $entry, $wholeentry);
        }
        //Amount of Braces is not correct
        $open = 0;
        $lastchar = '';
        $char = '';
        for ($i = 0; $i < strlen($entry); $i++) {
            $char = substr($entry, $i, 1);
            if (('{' == $char) && ('\\' != $lastchar)) {
                $open++;
            }
            if (('}' == $char) && ('\\' != $lastchar)) {
                $open--;
            }
            $lastchar = $char;
        }
        if (0 != $open) {
            $this->_generateWarning('WARNING_UNBALANCED_AMOUNT_OF_BRACES', $entry, $wholeentry);
        }
    }
function _validateValue($entry, $wholeentry)
    {
        //There is no @ allowed if the entry is enclosed by braces
        if (preg_match('/^{.*@.*}$/', $entry)) {
            $this->_generateWarning('WARNING_AT_IN_BRACES', $entry, $wholeentry);
        }
        //No escaped " allowed if the entry is enclosed by double quotes
        if (preg_match('/^\".*\\".*\"$/', $entry)) {
            $this->_generateWarning('WARNING_ESCAPED_DOUBLE_QUOTE_INSIDE_DOUBLE_QUOTES', $entry, $wholeentry);
        }
        //Amount of Braces is not correct
        $open = 0;
        $lastchar = '';
        $char = '';
        for ($i = 0; $i < strlen($entry); $i++) {
            $char = substr($entry, $i, 1);
            if (('{' == $char) && ('\\' != $lastchar)) {
                $open++;
            }
            if (('}' == $char) && ('\\' != $lastchar)) {
                $open--;
            }
            $lastchar = $char;
        }
        if (0 != $open) {
            $this->_generateWarning('WARNING_UNBALANCED_AMOUNT_OF_BRACES', $entry, $wholeentry);
        }
    }
function _validateValue ( $ entry , $ wholeentry ) { //There is no @ allowed if the entry is enclosed by braces if ( preg_match ( '/^{.*@.*}$/' , $ entry ) ) { $ this -> _generateWarning ( 'WARNING_AT_IN_BRACES' , $ entry , $ wholeentry ) ; } //No escaped " allowed if the entry is enclosed by double quotes if ( preg_match ( '/^\".*\\".*\"$/' , $ entry ) ) { $ this -> _generateWarning ( 'WARNING_ESCAPED_DOUBLE_QUOTE_INSIDE_DOUBLE_QUOTES' , $ entry , $ wholeentry ) ; } //Amount of Braces is not correct $ open = 0 ; $ lastchar = '' ; $ char = '' ; for ( $ i = 0 ; $ i < strlen ( $ entry ) ; $ i ++ ) { $ char = substr ( $ entry , $ i , 1 ) ; if ( ( '{' == $ char ) && ( '\\' != $ lastchar ) ) { $ open ++ ; } if ( ( '}' == $ char ) && ( '\\' != $ lastchar ) ) { $ open -- ; } $ lastchar = $ char ; } if ( 0 != $ open ) { $ this -> _generateWarning ( 'WARNING_UNBALANCED_AMOUNT_OF_BRACES' , $ entry , $ wholeentry ) ; } }
Validation of a value

There may be several problems with the value of a field.
These problems exist but do not break the parsing.
If a problem is detected a warning is appended to the array warnings.

@access private
@param string $entry The entry aka one line which which should be validated
@param string $wholeentry The whole BibTex Entry which the one line is part of
@return void
Validation of a value