- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/classes/mysql/cml2.php
- Класс: is
- Вызов: is::_get_xml_chunk_mb_orig
function _get_xml_chunk_mb_orig($fp)
{
if($this->buf_position >= $this->buf_len)
{
if(!feof($fp))
{
$this->buf = fread($fp, $this->read_size);
$this->buf_position = 0;
$this->buf_len = mb_orig_strlen($this->buf);
}
else
return false;
}
//Skip line delimiters (ltrim)
$xml_position = mb_orig_strpos($this->buf, "<", $this->buf_position);
while($xml_position === $this->buf_position)
{
$this->buf_position++;
$this->file_position++;
//Buffer ended with white space so we can refill it
if($this->buf_position >= $this->buf_len)
{
if(!feof($fp))
{
$this->buf = fread($fp, $this->read_size);
$this->buf_position = 0;
$this->buf_len = mb_orig_strlen($this->buf);
}
else
return false;
}
$xml_position = mb_orig_strpos($this->buf, "<", $this->buf_position);
}
//Let's find next line delimiter
while($xml_position===false)
{
$next_search = $this->buf_len;
//Delimiter not in buffer so try to add more data to it
if(!feof($fp))
{
$this->buf .= fread($fp, $this->read_size);
$this->buf_len = mb_orig_strlen($this->buf);
}
else
break;
//Let's find xml tag start
$xml_position = mb_orig_strpos($this->buf, "<", $next_search);
}
if($xml_position===false)
$xml_position = $this->buf_len+1;
$len = $xml_position-$this->buf_position;
$this->file_position += $len;
$result = mb_orig_substr($this->buf, $this->buf_position, $len);
$this->buf_position = $xml_position;
return $result;
}