| [ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 <?php declare(strict_types=1); 2 3 /** 4 * @package s9e\TextFormatter 5 * @copyright Copyright (c) 2010-2022 The s9e authors 6 * @license http://www.opensource.org/licenses/mit-license.php The MIT License 7 */ 8 namespace s9e\TextFormatter\Configurator\Items\AttributeFilters; 9 10 use RuntimeException; 11 use s9e\TextFormatter\Configurator\Helpers\ContextSafeness; 12 use s9e\TextFormatter\Configurator\Items\AttributeFilter; 13 14 abstract class AbstractMapFilter extends AttributeFilter 15 { 16 /** 17 * {@inheritdoc} 18 */ 19 public function asConfig() 20 { 21 if (!isset($this->vars['map'])) 22 { 23 $name = preg_replace('(.*\\\\|Filter$)', '', get_class($this)); 24 25 throw new RuntimeException($name . " filter is missing a 'map' value"); 26 } 27 28 return parent::asConfig(); 29 } 30 31 /** 32 * Assess the safeness of this attribute filter based on given list of strings 33 * 34 * @param string[] $strings 35 * @return void 36 */ 37 protected function assessSafeness(array $strings): void 38 { 39 $str = implode('', $strings); 40 foreach (['AsURL', 'InCSS', 'InJS'] as $context) 41 { 42 $callback = ContextSafeness::class . '::getDisallowedCharacters' . $context; 43 foreach ($callback() as $char) 44 { 45 if (strpos($str, $char) !== false) 46 { 47 continue 2; 48 } 49 } 50 51 $methodName = 'markAsSafe' . $context; 52 $this->$methodName(); 53 } 54 } 55 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |