Line 35 | Line 35 |
---|
/** * Constructor *
|
/** * Constructor *
|
* @param \phpbb\cache\driver_interface $cache
| * @param \phpbb\cache\driver\driver_interface $cache
|
* @param string $key Cache key * @param factory $factory * @param \phpbb\event\dispatcher_interface $dispatcher
| * @param string $key Cache key * @param factory $factory * @param \phpbb\event\dispatcher_interface $dispatcher
|
Line 197 | Line 197 |
---|
public function get_errors() { $errors = array();
|
public function get_errors() { $errors = array();
|
foreach ($this->parser->getLogger()->getLogs() as $entry)
| $entries = $this->parser->getLogger()->getLogs();
foreach ($entries as $entry)
|
{ list(, $msg, $context) = $entry;
| { list(, $msg, $context) = $entry;
|
Line 236 | Line 238 |
---|
{ $errors = array_map('unserialize', array_unique(array_map('serialize', $errors))); }
|
{ $errors = array_map('unserialize', array_unique(array_map('serialize', $errors))); }
|
| $parser = $this;
/** * Modify error messages generated by the s9e\TextFormatter's logger * * @event core.text_formatter_s9e_get_errors * @var parser parser This parser service * @var array entries s9e\TextFormatter's logger entries * @var array errors Error arrays with language key and optional arguments * @since 3.2.10-RC1 * @since 3.3.1-RC1 */ $vars = [ 'parser', 'entries', 'errors', ]; extract($this->dispatcher->trigger_event('core.text_formatter_s9e_get_errors', compact($vars)));
|
return $errors; }
| return $errors; }
|
Line 359 | Line 380 |
---|
* @param string $url Original URL * @param array $url_config Config used by the URL filter * @param Logger $logger
|
* @param string $url Original URL * @param array $url_config Config used by the URL filter * @param Logger $logger
|
* @param integer $max_height Maximum height allowed * @param integer $max_width Maximum width allowed
| *
|
* @return string|bool Original value if valid, FALSE otherwise */
|
* @return string|bool Original value if valid, FALSE otherwise */
|
static public function filter_img_url($url, array $url_config, Logger $logger, $max_height, $max_width)
| static public function filter_img_url($url, array $url_config, Logger $logger)
|
{ // Validate the URL $url = UrlFilter::filter($url, $url_config, $logger); if ($url === false) { return false;
|
{ // Validate the URL $url = UrlFilter::filter($url, $url_config, $logger); if ($url === false) { return false;
|
}
if ($max_height || $max_width) { $imagesize = new \FastImageSize\FastImageSize(); $size_info = $imagesize->getImageSize($url); if ($size_info === false) { $logger->err('UNABLE_GET_IMAGE_SIZE'); return false; }
if ($max_height && $max_height < $size_info['height']) { $logger->err('MAX_IMG_HEIGHT_EXCEEDED', array('max_height' => $max_height)); return false; }
if ($max_width && $max_width < $size_info['width']) { $logger->err('MAX_IMG_WIDTH_EXCEEDED', array('max_width' => $max_width)); return false; }
| |
}
return $url;
| }
return $url;
|