phpBB

Code Changes

File: phpbb/textformatter/s9e/parser.php

  Unmodified   Added   Modified   Removed
Line 15Line 15

use s9e\TextFormatter\Parser\AttributeFilters\UrlFilter;
use s9e\TextFormatter\Parser\Logger;


use s9e\TextFormatter\Parser\AttributeFilters\UrlFilter;
use s9e\TextFormatter\Parser\Logger;

 
use s9e\TextFormatter\Parser\Tag;


/**
* s9e\TextFormatter\Parser adapter


/**
* s9e\TextFormatter\Parser adapter

Line 219Line 220
			{
$errors[] = array($msg, $context['max_' . strtolower($m[1])]);
}

			{
$errors[] = array($msg, $context['max_' . strtolower($m[1])]);
}

			else if ($msg === 'Tag is disabled')

			else if ($msg === 'Tag is disabled' && $this->is_a_bbcode($context['tag']))

			{
$name = strtolower($context['tag']->getName());
$errors[] = array('UNAUTHORISED_BBCODE', '[' . $name . ']');

			{
$name = strtolower($context['tag']->getName());
$errors[] = array('UNAUTHORISED_BBCODE', '[' . $name . ']');

Line 342Line 343
			return false;
}


			return false;
}


		if ($size < 1)

		if ($size < 1 || !is_numeric($size))

		{
return false;
}

		{
return false;
}

Line 395Line 396
		}

return $url;

		}

return $url;

 
	}

/**
* Test whether given tag consumes text that looks like BBCode-styled markup
*
* @param Tag $tag Original tag
* @return bool
*/
protected function is_a_bbcode(Tag $tag)
{
if ($tag->getLen() < 3)
{
return false;
}
$markup = substr($this->parser->getText(), $tag->getPos(), $tag->getLen());

return (bool) preg_match('(^\\[\\w++.*?\\]$)s', $markup);

	}
}


	}
}