pQuery\HtmlParserBase::parse_conditional PHP Метод

parse_conditional() публичный Метод

Parse conditional tags (+ all conditional tags inside)
public parse_conditional ( ) : boolean
Результат boolean
    function parse_conditional()
    {
        if ($this->status['closing_tag']) {
            $this->pos += 8;
        } else {
            $this->pos += $this->status['comment'] ? 5 : 3;
            if ($this->next_pos(']', false) !== self::TOK_UNKNOWN) {
                $this->addError('"]" not found in conditional tag');
                return false;
            }
            $this->status['tag_condition'] = $this->getTokenString(0, -1);
        }
        if ($this->next_no_whitespace() !== self::TOK_TAG_CLOSE) {
            $this->addError('No ">" tag found 2 for conditional tag');
            return false;
        }
        if ($this->status['comment']) {
            $this->status['last_pos'] = $this->pos;
            if ($this->next_pos('-->', false) !== self::TOK_UNKNOWN) {
                $this->addError('No ending tag found for conditional tag');
                $this->pos = $this->size - 1;
                $len = $this->pos - 1 - $this->status['last_pos'];
                $this->status['text'] = $len > 0 ? substr($this->doc, $this->status['last_pos'] + 1, $len) : '';
            } else {
                $len = $this->pos - 10 - $this->status['last_pos'];
                $this->status['text'] = $len > 0 ? substr($this->doc, $this->status['last_pos'] + 1, $len) : '';
                $this->pos += 2;
            }
        }
        $this->status['last_pos'] = $this->pos;
        return true;
    }