Skip to content

Commit

Permalink
Merge branch 'master' into phpunit
Browse files Browse the repository at this point in the history
* master: (29 commits)
  some edge case checking in search result highlighting
  Resolve empty page ID to configured start page
  Added more detail error code for unauthorized calls in xmlrpc interface.
  changed internal Mailer members from private to protected
  made it possible to disable HTML mails in the config
  removed commented code left from the quoted_printable days
  add missing table tags for HTML diff mails
  fixed subscriber mail signatures
  use real HRs in HTML mails
  Add various headers to the mails FS#2247. pull request #83 closed
  removed footer image from HTML mails
  use inlinestyles for diffs in HTML mails
  fixed signature stripping
  fixed mailprefix handling
  fixed missing replacement for HTML notify mails
  allow image embeds in HTML mail templates
  Added HTML wrapper for mails
  allow non-txt extensions when accessing locales
  added Mailer class to autoloader
  Replaced mail_send calls with new Mailer class
  ...
  • Loading branch information
splitbrain committed Apr 20, 2012
2 parents f64856c + 8a803ca commit 73d2d14
Show file tree
Hide file tree
Showing 19 changed files with 848 additions and 138 deletions.
1 change: 1 addition & 0 deletions conf/dokuwiki.php
Expand Up @@ -110,6 +110,7 @@
$conf['registernotify'] = ''; //send info about newly registered users to this email (leave blank for nobody)
$conf['mailfrom'] = ''; //use this email when sending mails
$conf['mailprefix'] = ''; //use this as prefix of outgoing mails
$conf['htmlmail'] = 1; //send HTML multipart mails

/* Syndication Settings */
$conf['sitemap'] = 0; //Create a google sitemap? How often? In days.
Expand Down
61 changes: 47 additions & 14 deletions inc/DifferenceEngine.php
Expand Up @@ -818,6 +818,39 @@ function _changed($orig, $closing) {
}
}

/**
* Utilityclass for styling HTML formatted diffs
*
* Depends on global var $DIFF_INLINESTYLES, if true some minimal predefined
* inline styles are used. Useful for HTML mails and RSS feeds
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
class HTMLDiff {
/**
* Holds the style names and basic CSS
*/
static public $styles = array(
'diff-addedline' => 'background-color: #ddffdd;',
'diff-deletedline' => 'background-color: #ffdddd;',
'diff-context' => 'background-color: #f5f5f5;',
'diff-mark' => 'color: #ff0000;',
);

/**
* Return a class or style parameter
*/
static function css($classname){
global $DIFF_INLINESTYLES;

if($DIFF_INLINESTYLES){
if(!isset(self::$styles[$classname])) return '';
return 'style="'.self::$styles[$classname].'"';
}else{
return 'class="'.$classname.'"';
}
}
}

/**
* Additions by Axel Boldt follow, partly taken from diff.php, phpwiki-1.3.3
Expand All @@ -838,11 +871,11 @@ function __construct() {
function _flushGroup($new_tag) {
if ($this->_group !== '') {
if ($this->_tag == 'mark')
$this->_line .= '<strong>'.$this->_group.'</strong>';
$this->_line .= '<strong '.HTMLDiff::css('diff-mark').'>'.$this->_group.'</strong>';
elseif ($this->_tag == 'add')
$this->_line .= '<span class="diff-addedline">'.$this->_group.'</span>';
$this->_line .= '<span '.HTMLDiff::css('diff-addedline').'>'.$this->_group.'</span>';
elseif ($this->_tag == 'del')
$this->_line .= '<span class="diff-deletedline"><del>'.$this->_group.'</del></span>';
$this->_line .= '<span '.HTMLDiff::css('diff-deletedline').'><del>'.$this->_group.'</del></span>';
else
$this->_line .= $this->_group;
}
Expand Down Expand Up @@ -1020,8 +1053,8 @@ function _block_header($xbeg, $xlen, $ybeg, $ylen) {
global $lang;
$l1 = $lang['line'].' '.$xbeg;
$l2 = $lang['line'].' '.$ybeg;
$r = '<tr><td class="diff-blockheader" colspan="2">'.$l1.":</td>\n".
'<td class="diff-blockheader" colspan="2">'.$l2.":</td>\n".
$r = '<tr><td '.HTMLDiff::css('diff-blockheader').' colspan="2">'.$l1.":</td>\n".
'<td '.HTMLDiff::css('diff-blockheader').' colspan="2">'.$l2.":</td>\n".
"</tr>\n";
return $r;
}
Expand All @@ -1037,19 +1070,19 @@ function _lines($lines, $prefix=' ', $color="white") {
}

function addedLine($line) {
return '<td>+</td><td class="diff-addedline">' . $line.'</td>';
return '<td>+</td><td '.HTMLDiff::css('diff-addedline').'>' . $line.'</td>';
}

function deletedLine($line) {
return '<td>-</td><td class="diff-deletedline">' . $line.'</td>';
return '<td>-</td><td '.HTMLDiff::css('diff-deletedline').'>' . $line.'</td>';
}

function emptyLine() {
return '<td colspan="2">&nbsp;</td>';
}

function contextLine($line) {
return '<td> </td><td class="diff-context">'.$line.'</td>';
return '<td> </td><td '.HTMLDiff::css('diff-context').'>'.$line.'</td>';
}

function _added($lines) {
Expand Down Expand Up @@ -1115,9 +1148,9 @@ function _block_header($xbeg, $xlen, $ybeg, $ylen) {
$xbeg .= "," . $xlen;
if ($ylen != 1)
$ybeg .= "," . $ylen;
$r = '<tr><td colspan="'.$this->colspan.'" class="diff-blockheader">@@ '.$lang['line']." -$xbeg +$ybeg @@";
$r .= ' <span class="diff-deletedline"><del>'.$lang['deleted'].'</del></span>';
$r .= ' <span class="diff-addedline">'.$lang['created'].'</span>';
$r = '<tr><td colspan="'.$this->colspan.'" '.HTMLDiff::css('diff-blockheader').'>@@ '.$lang['line']." -$xbeg +$ybeg @@";
$r .= ' <span '.HTMLDiff::css('diff-deletedline').'><del>'.$lang['deleted'].'</del></span>';
$r .= ' <span '.HTMLDiff::css('diff-addedline').'>'.$lang['created'].'</span>';
$r .= "</td></tr>\n";
return $r;
}
Expand All @@ -1134,19 +1167,19 @@ function _lines($lines, $prefix=' ', $color="white") {

function _added($lines) {
foreach ($lines as $line) {
print('<tr><td colspan="'.$this->colspan.'" class="diff-addedline">'. $line . "</td></tr>\n");
print('<tr><td colspan="'.$this->colspan.'" '.HTMLDiff::css('diff-addedline').'>'. $line . "</td></tr>\n");
}
}

function _deleted($lines) {
foreach ($lines as $line) {
print('<tr><td colspan="'.$this->colspan.'" class="diff-deletedline"><del>' . $line . "</del></td></tr>\n");
print('<tr><td colspan="'.$this->colspan.'" '.HTMLDiff::css('diff-deletedline').'><del>' . $line . "</del></td></tr>\n");
}
}

function _context($lines) {
foreach ($lines as $line) {
print('<tr><td colspan="'.$this->colspan.'" class="diff-context">'.$line."</td></tr>\n");
print('<tr><td colspan="'.$this->colspan.'" '.HTMLDiff::css('diff-context').'>'.$line."</td></tr>\n");
}
}

Expand Down

0 comments on commit 73d2d14

Please sign in to comment.