Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
1d2a23e8
Commit
1d2a23e8
authored
Jul 15, 2009
by
Richard Mansfield
Browse files
Modify Skype & Twitter filters to deal with TinyMCE 3 formatting
parent
2ea9d1d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/htmlpurifiercustom/Skype.php
View file @
1d2a23e8
...
...
@@ -6,15 +6,15 @@ class HTMLPurifier_Filter_Skype extends HTMLPurifier_Filter
public
$name
=
'Skype'
;
public
function
preFilter
(
$html
,
$config
,
$context
)
{
$pre_regex
=
'#<script\b[^>]+?\bsrc="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"[^>]*>\s*</script>'
.
'\s*<a\b[^>]+?\bhref="skype:([^?"<>]+)\?call"[^>]*>\s*
(
<img\
s+
src="http://(download|mystatus)\.skype\.com/[^<>]+>)\s*</a>#s'
;
$pre_replace
=
'<span class="skype-button"><span class="skype-name">\1</span>\2</span>'
;
$pre_regex
=
'#<script\b[^>]+?\bsrc="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"[^
<
>]*>\s*</script>'
.
'\s*<a\b[^
<
>]+?\bhref="skype:([^?"<>]+)\?call"[^>]*>\s*<img\
b[^<>]+?\b(
src="http://(download|mystatus)\.skype\.com/[^<>]+>)\s*</a>#s'
;
$pre_replace
=
'<span class="skype-button"><span class="skype-name">\1</span>
<img
\2</span>'
;
return
preg_replace
(
$pre_regex
,
$pre_replace
,
$html
);
}
public
function
postFilter
(
$html
,
$config
,
$context
)
{
$post_regex
=
'#<span class="skype-button"><span class="skype-name">([a-zA-Z0-9_,\.-]+)</span>'
.
'(<img\s+src="http://(download|mystatus)\.skype\.com/[\sa-zA-Z0-9"=_.:;!™-]+>)</span>#'
;
'(<img\s+src="http://(download|mystatus)\.skype\.com/[\s
/
a-zA-Z0-9"=_.:;!™-]+>)</span>#'
;
$post_replace
=
'<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script><a href="skype:\1?call">\2</a>'
;
return
preg_replace
(
$post_regex
,
$post_replace
,
$html
);
}
...
...
htdocs/lib/htmlpurifiercustom/Twitter.php
View file @
1d2a23e8
...
...
@@ -24,8 +24,8 @@ class HTMLPurifier_Filter_Twitter extends HTMLPurifier_Filter
public
function
postFilter
(
$html
,
$config
,
$context
)
{
$post_regex
=
array
(
'#<span class="twitter-updates-js"><span class="title">([^<]+)</span><span class="username">([a-zA-Z0-9_]+)</span><span class="count">(\d+)</span></span>#'
,
'#<span class="twitter-badge-flash">([a-zA-Z0-9_=&\.,-]+)</span>#'
,
'#<span class="twitter-timeline-badge-flash">([a-zA-Z0-9_=&\.,-]+)</span>#'
,
'#<span class="twitter-badge-flash">(
(
[a-zA-Z0-9_=&\.,-]+
|&)+
)</span>#'
,
'#<span class="twitter-timeline-badge-flash">(
(
[a-zA-Z0-9_=&\.,-]+
|&)+
)</span>#'
,
);
$post_replace
=
array
(
'<div id="twitter_div"><h2 class="sidebar-title">\1</h2><ul id="twitter_update_list"></ul></div>'
.
...
...
htdocs/lib/web.php
View file @
1d2a23e8
...
...
@@ -174,6 +174,7 @@ tinyMCE.init({
content_css : {$content_css},
forced_root_block : "",
force_p_newlines : false,
apply_source_formatting: false,
//document_base_url: {$jswwwroot},
relative_urls: false
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment