From 182ac905691e45146536796b39ef9f1420fb79b5 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 24 Jan 2013 15:17:01 +0100 Subject: fix custom editor loading Custom editors can also be loaded when not a section is given. For example this happens on a preview click where the page is already separated into pre, suf and text. --- inc/html.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index f4e6af663..5c1c75cf6 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1390,8 +1390,7 @@ function html_edit(){ $data = array('form' => $form, 'wr' => $wr, 'media_manager' => true, - 'target' => ($INPUT->has('target') && $wr && - $RANGE !== '') ? $INPUT->str('target') : 'section', + 'target' => ($INPUT->has('target') && $wr) ? $INPUT->str('target') : 'section', 'intro_locale' => $include); if ($data['target'] !== 'section') { -- cgit v1.2.3 From fcfecb69832d5532b9c7d5362e4b7bb781c8fa11 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sat, 26 Jan 2013 16:51:16 +0000 Subject: fix for FS#2676, inserting zero length spaces into long sequences of non-breaking characters in diffs --- inc/html.php | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 5c1c75cf6..89a8a4c7d 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1154,8 +1154,7 @@ function html_diff($text='',$intro=true,$type=null){ list($l_head, $r_head, $l_minor, $r_minor) = html_diff_head($l_rev, $r_rev); } - $df = new Diff(explode("\n",htmlspecialchars($l_text)), - explode("\n",htmlspecialchars($r_text))); + $df = new Diff(explode("\n",hsc($l_text)),explode("\n",hsc($r_text))); if($type == 'inline'){ $tdf = new InlineDiffFormatter(); @@ -1205,12 +1204,38 @@ function html_diff($text='',$intro=true,$type=null){ - format($df)?> + format($df)); ?> ]*>|[^<> ]{12,}/','html_softbreak_callback',$diffhtml); +} + +function html_softbreak_callback($match){ + // if match is an html tag, return it intact + if ($match[0]{0} == '<') return $match[0]; + + // its a long string without a breaking character, + // make certain characters into breaking characters by inserting a + // breaking character (zero length space, U+200B / #8203) in front them. + $regex = <<< REGEX +(?(?= # start a conditional expression with a positive look ahead ... +&(\#\\d{1,4}|[[:alpha:]]{1,4});) # ... for html entities - we don't want to split them +&\#?\\w{1,4}; # yes pattern - a quicker match for the html entity, since we know we have one +| +[?/,&\#;:]+ # no pattern - any other group of 'special' characters to insert a breaking character after +) # end conditional expression +REGEX; + + return preg_replace('<'.$regex.'>xu','\0​',$match[0]); +} + /** * show warning on conflict detection * -- cgit v1.2.3 From 298a7e081c2658a706ddd08b713b3f1c420564c4 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sat, 26 Jan 2013 18:39:30 +0000 Subject: update pattern to catch more html entities --- inc/html.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 89a8a4c7d..f72316a5e 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1226,8 +1226,8 @@ function html_softbreak_callback($match){ // breaking character (zero length space, U+200B / #8203) in front them. $regex = <<< REGEX (?(?= # start a conditional expression with a positive look ahead ... -&(\#\\d{1,4}|[[:alpha:]]{1,4});) # ... for html entities - we don't want to split them -&\#?\\w{1,4}; # yes pattern - a quicker match for the html entity, since we know we have one +&\#?\\w{1,6};) # ... for html entities - we don't want to split them (ok to catch some invalid combinations) +&\#?\\w{1,6}; # yes pattern - a quicker match for the html entity, since we know we have one | [?/,&\#;:]+ # no pattern - any other group of 'special' characters to insert a breaking character after ) # end conditional expression -- cgit v1.2.3 From fc7684bc7f41c3351955f71b8a94a73bb11aa358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Corinth?= Date: Wed, 30 Jan 2013 14:36:09 +0100 Subject: Added the title attribute for namespace-links --- inc/html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 5c1c75cf6..3124f4b1d 100644 --- a/inc/html.php +++ b/inc/html.php @@ -859,7 +859,7 @@ function html_list_index($item){ $base = ':'.$item['id']; $base = substr($base,strrpos($base,':')+1); if($item['type']=='d'){ - $ret .= ''; + $ret .= ''; $ret .= $base; $ret .= ''; }else{ -- cgit v1.2.3