|
14 | 14 | // You should have received a copy of the GNU General Public License
|
15 | 15 | // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
16 | 16 |
|
| 17 | +namespace filter_smartmedia; |
| 18 | + |
17 | 19 | use local_smartmedia\conversion;
|
18 | 20 | use core\plugininfo\media;
|
19 | 21 | use core\url;
|
|
22 | 24 | use core\context\course;
|
23 | 25 | use local_smartmedia\aws_api;
|
24 | 26 | use local_smartmedia\aws_elastic_transcoder;
|
| 27 | +use core_media_manager; |
| 28 | +use core_media_player_native; |
| 29 | +use media_videojs_plugin; |
| 30 | +use DOMDocument; |
| 31 | +use DOMXPath; |
| 32 | +use stdClass; |
| 33 | +use core\output\single_button; |
25 | 34 |
|
26 | 35 | /**
|
27 | 36 | * Automatic smart media embedding filter class.
|
|
30 | 39 | * @copyright 2019 Matt Porritt <mattp@catalyst-au.net>
|
31 | 40 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
32 | 41 | */
|
33 |
| -class filter_smartmedia extends moodle_text_filter { |
| 42 | +class text_filter extends \core_filters\text_filter { |
34 | 43 |
|
35 | 44 | /**
|
36 | 45 | * Video.js plugin enabled status not set.
|
@@ -126,7 +135,7 @@ class filter_smartmedia extends moodle_text_filter {
|
126 | 135 | * @param array $localconfig Any context-specific configuration for this filter.
|
127 | 136 | * @param conversion|null $conversion
|
128 | 137 | */
|
129 |
| - public function __construct($context, array $localconfig, conversion $conversion = null) { |
| 138 | + public function __construct($context, array $localconfig, ?conversion $conversion = null) { |
130 | 139 | parent::__construct($context, $localconfig);
|
131 | 140 |
|
132 | 141 | if (!empty($conversion)) {
|
@@ -576,7 +585,7 @@ public function filter($text, array $options = []) {
|
576 | 585 | // Add a wrapping div so DOMDocument doesnt mangle the structure.
|
577 | 586 | $loadtext = '<div>' . $text . '</div>';
|
578 | 587 | // Ensure the encoding can be loaded by the domdoc.
|
579 |
| - $loadtext = mb_convert_encoding($loadtext, 'HTML-ENTITIES', 'UTF-8'); |
| 588 | + $loadtext = htmlspecialchars($loadtext); |
580 | 589 |
|
581 | 590 | // Supress warnings. HTML5 nodes currently throw warnings.
|
582 | 591 | // Use flags to prevent html and body tags from being included.
|
@@ -653,7 +662,7 @@ public function filter($text, array $options = []) {
|
653 | 662 | if ($link->isSameNode($newlink)) {
|
654 | 663 | $exists = true;
|
655 | 664 | }
|
656 |
| - } catch (Throwable $e) { |
| 665 | + } catch (\Throwable $e) { |
657 | 666 | // Some error, likely when the $link is no longer a valid DOMElement.
|
658 | 667 | continue;
|
659 | 668 | }
|
|
0 commit comments