• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/php_parser.php
  • Класс: PHPParser
  • Вызов: PHPParser::getPageTitle
static function getPageTitle($filesrc, $prolog = false)
{
	if ($prolog === false)
	{
		$chunks = PHPParser::getPhpChunks($filesrc, 1);
		if (!empty($chunks))
			$prolog = &$chunks[0];
		else
			$prolog = '';
	}

	$title = false;

	if ($prolog != '')
	{
		if(preg_match("/\$APPLICATION->SetTitle\s*\(\s*"(.*?)(?SetTitle\s*\(\s*'(.*?)(?]*>([^>]+)]*>'i", $prolog, $regs))
			$title = $regs[1];
	}

	if(!$title && preg_match("']*>([^>]+)]*>'i", $filesrc, $regs))
		$title = $regs[1];

	return $title;
}