summaryrefslogtreecommitdiff
path: root/inc/html.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2013-02-03 22:57:45 +0100
committerAndreas Gohr <andi@splitbrain.org>2013-02-03 22:57:45 +0100
commit3da7921f08ecdda929466921ecc50698f1adf99e (patch)
tree0e179e504399e874bfd785d0a95eec44b76d5952 /inc/html.php
parent6cf2bbfa12b776cf47cb69ae40fb8862f715ad01 (diff)
parentcc4bb766fdac23358d7b586aa3830b9650eed7a8 (diff)
downloadrpg-3da7921f08ecdda929466921ecc50698f1adf99e.tar.gz
rpg-3da7921f08ecdda929466921ecc50698f1adf99e.tar.bz2
Merge branch 'master' into future
* master: (162 commits) fixed revision JS for images upgraded SimplePie to 1.3.1 FS#2708 removed obsolete browser plugin (migrate does it) adjust spacing to match standard 1.4em grid added comment on use of whitelist vs blacklist Updated idfilter() function for IIS use var and remove suggestions when needed Use variable for maximum number of suggestions for quicksearch. And hide suggestions when search field is emptied, or when no suggestion are found. added 'home' class to first link in hierarchical breadcrumbs reduced required max width to go into tablet mode re-added linear gradients for firefox added missing styling for disabled form elements (FS#2705) fixed acronyms in italics (FS#2684) improved print styles (includes fixes for FS#2645 and FS#2707) basic styles improvements Greek language update Use list in acl help text, for more structure Galician language update touch the config on save, even if no changes were made unwind the width narrowing commit put some whitespace between form submit button and fieldset bottom border ... Conflicts: lib/plugins/config/admin.php lib/plugins/config/settings/config.class.php
Diffstat (limited to 'inc/html.php')
-rw-r--r--inc/html.php36
1 files changed, 30 insertions, 6 deletions
diff --git a/inc/html.php b/inc/html.php
index f4e6af663..c8b96cbc0 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 .= '<a href="'.wl($ID,'idx='.rawurlencode($item['id'])).'" class="idx_dir"><strong>';
+ $ret .= '<a href="'.wl($ID,'idx='.rawurlencode($item['id'])).'" title="' . $item['id'] . '" class="idx_dir"><strong>';
$ret .= $base;
$ret .= '</strong></a>';
}else{
@@ -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){
<?php echo $r_head?>
</th>
</tr>
- <?php echo $tdf->format($df)?>
+ <?php echo html_insert_softbreaks($tdf->format($df)); ?>
</table>
</div>
<?php
}
+function html_insert_softbreaks($diffhtml) {
+ // search the diff html string for both:
+ // - html tags, so these can be ignored
+ // - long strings of characters without breaking characters
+ return preg_replace_callback('/<[^>]*>|[^<> ]{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 ...
+&\#?\\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
+REGEX;
+
+ return preg_replace('<'.$regex.'>xu','\0&#8203;',$match[0]);
+}
+
/**
* show warning on conflict detection
*
@@ -1390,8 +1415,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') {