1: <?php
2: /*
3: You may not change or alter any portion of this comment or credits
4: of supporting developers from this source code or any supporting source code
5: which is considered copyrighted (c) material of the original comment or credit authors.
6:
7: This program is distributed in the hope that it will be useful,
8: but WITHOUT ANY WARRANTY; without even the implied warranty of
9: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: */
11:
12: namespace Xoops\Core\Text\Sanitizer;
13:
14: use Xoops\Core\Text\Sanitizer;
15: use Xoops\Core\Text\ShortCodes;
16:
17: /**
18: * XOOPS Text/Sanitizer/SanitizerComponent - extension, filter
19: *
20: * @category Sanitizer
21: * @package Xoops\Core\Text
22: * @author Richard Griffith <richard@geekwright.com>
23: * @copyright 2015 XOOPS Project (http://xoops.org)
24: * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
25: * @link http://xoops.org
26: */
27: abstract class SanitizerComponent extends SanitizerConfigurable
28: {
29: /**
30: * @var Sanitizer
31: */
32: protected $ts;
33:
34: /**
35: * @var ShortCodes
36: */
37: protected $shortcodes;
38:
39: /**
40: * @var array
41: */
42: protected $config = [];
43:
44: /**
45: * Constructor
46: *
47: * @param Sanitizer $ts text sanitizer instance being extended
48: */
49: public function __construct(Sanitizer $ts)
50: {
51: $this->ts = $ts;
52: $fullName = get_called_class();
53: $shortName = ($pos = strrpos($fullName, '\\')) ? substr($fullName, $pos + 1) : $fullName;
54: $this->config = $ts->getConfig($shortName);
55: $this->shortcodes = $ts->getShortCodesInstance();
56: }
57: }
58: