ÿØÿà JFIF    ÿÛ „  ( %"1!%)+...383,7(-.+  -+++--++++---+-+-----+---------------+---+-++7-----ÿÀ  ß â" ÿÄ     ÿÄ H    !1AQaq"‘¡2B±ÁÑð#R“Ò Tbr‚²á3csƒ’ÂñDS¢³$CÿÄ   ÿÄ %  !1AQa"23‘ÿÚ   ? ôÿ ¨pŸªáÿ —åYõõ\?àÒü©ŠÄï¨pŸªáÿ —åYõõ\?àÓü©ŠÄá 0Ÿªáÿ Ÿå[úƒ ú®ði~TÁbqÐ8OÕpÿ ƒOò¤Oè`–RÂáœá™êi€ßÉ< FtŸI“öÌ8úDf´°å}“¾œ6  öFá°y¥jñÇh†ˆ¢ã/ÃÐ:ªcÈ "Y¡ðÑl>ÿ ”ÏËte:qž\oäŠe÷󲍷˜HT4&ÿ ÓÐü6ö®¿øþßèô Ÿ•7Ñi’•j|“ñì>b…þS?*Óôÿ ÓÐü*h¥£ír¶ü UãS炟[AÐaè[ûª•õ&õj?†Éö+EzP—WeÒírJFt ‘BŒ†Ï‡%#tE Øz ¥OÛ«!1›üä±Í™%ºÍãö]°î(–:@<‹ŒÊö×òÆt¦ãº+‡¦%ÌÁ²h´OƒJŒtMÜ>ÀÜÊw3Y´•牋4ǍýʏTì>œú=Íwhyë,¾Ôò×õ¿ßÊa»«þˆѪQ|%6ž™A õ%:øj<>É—ÿ Å_ˆCbõ¥š±ý¯Ýƒï…¶|RëócÍf溪“t.СøTÿ *Ä¿-{†çàczůŽ_–^XþŒ±miB[X±d 1,é”zEù»& î9gœf™9Ð'.;—™i}!ôšåîqêÛ٤ёý£½ÆA–àôe"A$˝Úsäÿ ÷Û #°xŸëí(l »ý3—¥5m! rt`†0~'j2(]S¦¦kv,ÚÇ l¦øJA£Šƒ J3E8ÙiŽ:cÉžúeZ°€¯\®kÖ(79«Ž:¯X”¾³Š&¡* ….‰Ž(ÜíŸ2¥ª‡×Hi²TF¤ò[¨íÈRëÉ䢍mgÑ.Ÿ<öäS0í„ǹÁU´f#Vß;Õ–…P@3ío<ä-±»Ž.L|kªÀê›fÂ6@»eu‚|ÓaÞÆŸ…¨ááå>åŠ?cKü6ùTÍÆ”†sĤÚ;H2RÚ†õ\Ö·Ÿn'¾ ñ#ºI¤Å´%çÁ­‚â7›‹qT3Iï¨ÖÚ5I7Ë!ÅOóŸ¶øÝñØôת¦$Tcö‘[«Ö³šÒ';Aþ ¸èíg A2Z"i¸vdÄ÷.iõ®§)¿]¤À†–‡É&ä{V¶iŽ”.Ó×Õÿ û?h¬Mt–íª[ÿ Ñÿ ÌV(í}=ibÔ¡›¥¢±b Lô¥‡piη_Z<‡z§èŒ)iÖwiÇ 2hÙ3·=’d÷8éŽ1¦¸c¤µ€7›7Ø ð\á)} ¹fËí›pAÃL%âc2 í§æQz¿;T8sæ°qø)QFMð‰XŒÂ±N¢aF¨…8¯!U  Z©RÊ ÖPVÄÀÍin™Ì-GˆªÅËŠ›•zË}º±ŽÍFò¹}Uw×#ä5B¤{î}Ð<ÙD é©¤&‡ïDbàÁôMÁ.. /** * Filter converting URLs in the text to HTML links * * @package filter * @subpackage urltolink * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); class filter_urltolink extends moodle_text_filter { /** * @var array global configuration for this filter * * This might be eventually moved into parent class if we found it * useful for other filters, too. */ protected static $globalconfig; /** * Apply the filter to the text * * @see filter_manager::apply_filter_chain() * @param string $text to be processed by the text * @param array $options filter options * @return string text after processing */ public function filter($text, array $options = array()) { 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 URL with the link because it could // be stripped. therefore, we do nothing return $text; } if (in_array($options['originalformat'], explode(',', get_config('filter_urltolink', 'formats')))) { $this->convert_urls_into_links($text); } return $text; } //////////////////////////////////////////////////////////////////////////// // internal implementation starts here //////////////////////////////////////////////////////////////////////////// /** * Given some text this function converts any URLs it finds into HTML links * * @param string $text Passed in by reference. The string to be searched for urls. */ protected function convert_urls_into_links(&$text) { //I've added img tags to this list of tags to ignore. //See MDL-21168 for more info. A better way to ignore tags whether or not //they are escaped partially or completely would be desirable. For example: // //<a href="blah"> //<a href="blah"> $filterignoretagsopen = array(']+?>', ']+?class="nolink"[^>]*?>'); $filterignoretagsclose = array('', ''); $ignoretags = []; filter_save_ignore_tags($text,$filterignoretagsopen,$filterignoretagsclose,$ignoretags); // Check if we support unicode modifiers in regular expressions. Cache it. // TODO: this check should be a environment requirement in Moodle 2.0, as far as unicode // chars are going to arrive to URLs officially really soon (2010?) // Original RFC regex from: http://www.bytemycode.com/snippets/snippet/796/ // Various ideas from: http://alanstorm.com/url_regex_explained // Unicode check, negative assertion and other bits from Moodle. static $unicoderegexp; if (!isset($unicoderegexp)) { $unicoderegexp = @preg_match('/\pL/u', 'a'); // This will fail silently, returning false, } // TODO MDL-21296 - use of unicode modifiers may cause a timeout $urlstart = '(?:http(s)?://|(?]*>)/i', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); // Iterate through the tokenized text to handle chunks (html and content). foreach ($matches as $idx => $chunk) { // Nothing to do. We skip completely any html chunk. if (strpos(trim($chunk), '<') === 0) { continue; } // Nothing to do. We skip any content chunk having any of these attributes. if (preg_match('#(background=")|(action=")|(style="background)|(href=")|(src=")|(url [(])#', $chunk)) { continue; } // Arrived here, we want to process every word in this chunk. $text = $chunk; $words = explode(' ', $text); foreach ($words as $idx2 => $word) { // ReDoS protection. Stop processing if a word is too large. if (strlen($word) < 4096) { $words[$idx2] = preg_replace($regex, '$0', $word); } } $text = implode(' ', $words); // Copy the result back to the array. $matches[$idx] = $text; } $text = implode('', $matches); if (!empty($ignoretags)) { $ignoretags = array_reverse($ignoretags); /// Reversed so "progressive" str_replace() will solve some nesting problems. $text = str_replace(array_keys($ignoretags),$ignoretags,$text); } if (get_config('filter_urltolink', 'embedimages')) { // now try to inject the images, this code was originally in the mediapluing filter // this may be useful only if somebody relies on the fact the links in FORMAT_MOODLE get converted // to URLs which in turn change to real images $search = '/([^>]*)<\/a>/is'; $text = preg_replace_callback($search, 'filter_urltolink_img_callback', $text); } } } /** * Change links to images into embedded images. * * This plugin is intended for automatic conversion of image URLs when FORMAT_MOODLE used. * * @param $link * @return string */ function filter_urltolink_img_callback($link) { if ($link[1] !== $link[3]) { // this is not a link created by this filter, because the url does not match the text return $link[0]; } return ''; }