ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilMWParserAdapter.php
Go to the documentation of this file.
1<?php
2
3if (!function_exists("wfProfileIn")) {
4 function wfProfileIn($dummy)
5 {
6 }
7}
8if (!function_exists("wfProfileOut")) {
9 function wfProfileOut($dummy)
10 {
11 }
12}
13
14include_once("./include/Unicode/UtfNormalUtil.php");
15
16// From include/Unicode/UtfNormal.php
17define('UTF8_REPLACEMENT', "\xef\xbf\xbd" /*codepointToUtf8( UNICODE_REPLACEMENT )*/);
18
25{
26 global $wgUrlProtocols;
27
28 $wgUrlProtocols = array(
29 'http://',
30 'https://',
31 'ftp://',
32 'irc://',
33 'gopher://',
34 'telnet://', // Well if we're going to support the above.. -ævar
35 'nntp://', // @bug 3808 RFC 1738
36 'worldwind://',
37 'mailto:',
38 'news:'
39 );
40
41
42 // Support old-style $wgUrlProtocols strings, for backwards compatibility
43 // with LocalSettings files from 1.5
44 if (is_array($wgUrlProtocols)) {
45 $protocols = array();
46 foreach ($wgUrlProtocols as $protocol) {
47 $protocols[] = preg_quote($protocol, '/');
48 }
49
50 return implode('|', $protocols);
51 } else {
52 return $wgUrlProtocols;
53 }
54}
55
56include_once("./Services/Utilities/classes/Parser.php");
57include_once("./Services/Utilities/classes/Sanitizer.php");
58
60{
61 public function getSkin()
62 {
63 return $this;
64 }
65
66 // from Linker.php
67 public function makeExternalLink($url, $text, $escape = true, $linktype = '', $ns = null)
68 {
69 //$style = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
70 //global $wgNoFollowLinks, $wgNoFollowNsExceptions;
71 //if( $wgNoFollowLinks && !(isset($ns) && in_array($ns, $wgNoFollowNsExceptions)) ) {
72 // $style .= ' rel="nofollow"';
73 //}
74 $url = htmlspecialchars($url);
75 if ($escape) {
76 $text = htmlspecialchars($text);
77 }
78
79 // handle images
80 $urlpath = parse_url($url, PHP_URL_PATH);
81 $pi = pathinfo($urlpath);
82 if (in_array(strtolower($pi["extension"]), array("jpg", "jpeg", "gif", "png"))) {
83 return '<img src="' . $url . '" border="0" />';
84 } else {
85 return '<a href="' . $url . '" target="_blank" rel="noopener">' . $text . '</a>';
86 }
87 //return '<a href="'.$url.'"'.$style.'>'.$text.'</a>';
88 }
89
90 public function markNoConversion($text, $noParse=false)
91 {
92 return $text;
93 }
94
95 public function addExternalLink()
96 {
97 }
98
99 public function getNamespace()
100 {
101 return null;
102 }
103}
104
105$GLOBALS["wgContLang"] = new ilMWFakery();
106
108{
109 public function __construct()
110 {
111 parent::__construct();
112 $this->mOptions = new ilMWFakery();
113 $this->mTitle = new ilMWFakery();
114 $this->mOutput = new ilMWFakery();
115 }
116
118 {
119 return false;
120 }
121}
An exception for terminatinating execution or to throw for unit testing.
$GLOBALS["wgContLang"]
wfUrlProtocols()
Returns a regular expression of url protocols.
markNoConversion($text, $noParse=false)
makeExternalLink($url, $text, $escape=true, $linktype='', $ns=null)
maybeMakeExternalImage($url)
make an image if it's allowed, either through the global option or through the exception
$url
$text
Definition: errorreport.php:18