ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç db/install.php000064400000002122152266347340007321 0ustar00. /** * Emoticon filter post install hook. * * @package filter_emoticon * @copyright 2020 Simey Lameze * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); function xmldb_filter_emoticon_install() { global $CFG; require_once($CFG->libdir . "/filterlib.php"); filter_set_global_state('emoticon', TEXTFILTER_ON, 0); } db/renamedclasses.php000064400000001773152266347340010657 0ustar00. /** * Renamed classes for the filter_emoticon plugin. * * @package filter_emoticon * @copyright Jun Pataleta * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; $renamedclasses = [ 'filter_emoticon' => \filter_emoticon\text_filter::class, ]; lang/en/filter_emoticon.php000064400000002405152266347340011777 0ustar00. /** * Strings for filter_emoticon * * @package filter * @subpackage emoticon * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $string['filtername'] = 'Display emoticons as images'; $string['settingformats'] = 'Apply to formats'; $string['settingformats_desc'] = 'The filter will be applied only if the original text was inserted in one of the selected formats.'; $string['privacy:metadata'] = 'The Display emoticons as images plugin does not store any personal data.'; version.php000064400000002223152266347340006755 0ustar00. /** * Version information * * @package filter_emoticon * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $plugin->version = 2025041400; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2025040800; // Requires this Moodle version. $plugin->component = 'filter_emoticon'; // Full name of the plugin (used for diagnostics) filter.php000064400000002303152266347340006554 0ustar00. /** * File only retained to prevent fatal errors in code that tries to require/include this. * * @todo MDL-82708 delete this file as part of Moodle 6.0 development. * @deprecated This file is no longer required in Moodle 4.5+. * @package filter_emoticon * @copyright David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); debugging('This file is no longer required in Moodle 4.5+. Please do not include/require it.', DEBUG_DEVELOPER); classes/privacy/provider.php000064400000003002152266347340012230 0ustar00. /** * Privacy Subsystem implementation for filter_emoticon. * * @package filter_emoticon * @copyright 2018 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace filter_emoticon\privacy; defined('MOODLE_INTERNAL') || die(); /** * Privacy Subsystem for filter_emoticon implementing null_provider. * * @copyright 2018 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements \core_privacy\local\metadata\null_provider { /** * Get the language string identifier with the component's language * file to explain why this plugin stores no data. * * @return string */ public static function get_reason(): string { return 'privacy:metadata'; } } classes/text_filter.php000064400000013002152266347340011253 0ustar00. namespace filter_emoticon; /** * Filter converting emoticon texts into images * * This filter uses the emoticon settings in Site admin > Appearance > HTML settings * and replaces emoticon texts with images. * * @package filter_emoticon * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class text_filter extends \core_filters\text_filter { /** * Internal cache used for replacing. Multidimensional array; * - dimension 1: language, * - dimension 2: theme. * @var array */ protected static $emoticontexts = []; /** * Internal cache used for replacing. Multidimensional array; * - dimension 1: language, * - dimension 2: theme. * @var array */ protected static $emoticonimgs = []; #[\Override] public function filter($text, array $options = []) { if (!isset($options['originalformat'])) { // If the format is not specified, we are probably called by {@see format_string()} // in that case, it would be dangerous to replace text with the image because it could // be stripped. therefore, we do nothing. return $text; } if (in_array($options['originalformat'], explode(',', get_config('filter_emoticon', 'formats')))) { return $this->replace_emoticons($text); } return $text; } /** * Replace emoticons found in the text with their images * * @param string $text to modify * @return string the modified result */ protected function replace_emoticons($text) { global $CFG, $OUTPUT, $PAGE; $lang = current_language(); $theme = $PAGE->theme->name; if (!isset(self::$emoticontexts[$lang][$theme]) || !isset(self::$emoticonimgs[$lang][$theme])) { // Prepare internal caches. $manager = get_emoticon_manager(); $emoticons = $manager->get_emoticons(); self::$emoticontexts[$lang][$theme] = []; self::$emoticonimgs[$lang][$theme] = []; foreach ($emoticons as $emoticon) { self::$emoticontexts[$lang][$theme][] = $emoticon->text; self::$emoticonimgs[$lang][$theme][] = $OUTPUT->render($manager->prepare_renderable_emoticon($emoticon)); } unset($emoticons); } if (empty(self::$emoticontexts[$lang][$theme])) { // No emoticons defined, nothing to process here. return $text; } // Detect all zones that we should not handle (including the nested tags). $processing = preg_split('/(<\/?(?:span|script|pre)[^>]*>)/is', $text, 0, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); // Initialize the results. $resulthtml = ""; $exclude = 0; // Define the patterns that mark the start of the forbidden zones. $excludepattern = ['/^", 'format' => FORMAT_HTML, 'expected' => "", ], 'Basic nolink should not be processed' => [ 'input' => '(n)', 'format' => FORMAT_HTML, 'expected' => '(n)', ], 'Nested nolink should not be processed' => [ 'input' => '(n)(n)', 'format' => FORMAT_HTML, 'expected' => '(n)(n)', ], 'Basic pre should not be processed' => [ 'input' => '
(n)
', 'format' => FORMAT_HTML, 'expected' => '
(n)
', ], 'Nested pre should not be processed' => [ 'input' => '
(n)
(n)
', 'format' => FORMAT_HTML, 'expected' => '
(n)
(n)
', ], ]; } /** * Translate the text for a single emoticon into the rendered value. * * @param string $text The text to translate. * @return string */ public function get_converted_content_for_emoticon($text) { global $OUTPUT; $manager = get_emoticon_manager(); $emoticons = $manager->get_emoticons(); foreach ($emoticons as $emoticon) { if ($emoticon->text == $text) { return $OUTPUT->render($manager->prepare_renderable_emoticon($emoticon)); } } return $text; } /** * Tests the filter doesn't break anything if activated but invalid format passed. */ public function test_filter_invalidformat(): void { global $PAGE; $this->resetAfterTest(); $filter = $this->get_testable_filter_emoticon(); $input = '(grr)'; $expected = '(grr)'; $this->assertEquals($expected, $filter->filter($input, [ 'originalformat' => 'ILLEGALFORMAT', ])); } /** * Tests the filter doesn't break anything if activated but no emoticons available. */ public function test_filter_emptyemoticons(): void { global $CFG; $this->resetAfterTest(); // Empty the emoticons array. $CFG->emoticons = null; $filter = new text_filter(context_system::instance(), ['originalformat' => FORMAT_HTML]); $input = '(grr)'; $expected = '(grr)'; $this->assertEquals($expected, $filter->filter($input, [ 'originalformat' => FORMAT_HTML, ])); } /** * Get a copy of the filter configured for testing. * * @param array ...$args * @return \filter_emoticon\text_filter */ protected function get_testable_filter_emoticon(...$args): text_filter { return new class extends text_filter { // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription public function __construct(...$args) { // Reset static emoticon caches. parent::$emoticontexts = []; parent::$emoticonimgs = []; // Use this context for filtering. $this->context = context_system::instance(); // Define FORMAT_HTML as only one filtering in DB. set_config('formats', implode(',', [FORMAT_HTML]), 'filter_emoticon'); } }; } } settings.php000064400000002337152266347340007136 0ustar00. /** * @package filter * @subpackage emoticon * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); if ($ADMIN->fulltree) { $settings->add(new admin_setting_configmulticheckbox('filter_emoticon/formats', get_string('settingformats', 'filter_emoticon'), get_string('settingformats_desc', 'filter_emoticon'), array(FORMAT_HTML => 1, FORMAT_MARKDOWN => 1, FORMAT_MOODLE => 1), format_text_menu())); }