summaryrefslogtreecommitdiff
path: root/inc/parser/xhtml.php
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-04-18 20:40:11 +0200
committerandi <andi@splitbrain.org>2005-04-18 20:40:11 +0200
commit71352def8211fd38eafe887a9ccd0e5365b34962 (patch)
tree77229b6da810d80dba09a61493cc8a1d87a99e5a /inc/parser/xhtml.php
parentbb0a59d46949357f85e4a8deabff585e56b906e5 (diff)
downloadrpg-71352def8211fd38eafe887a9ccd0e5365b34962.tar.gz
rpg-71352def8211fd38eafe887a9ccd0e5365b34962.tar.bz2
fixed email links #259
darcs-hash:20050418184011-9977f-acd3a6583e08ce3732af5ffc4fdc3027e284173e.gz
Diffstat (limited to 'inc/parser/xhtml.php')
-rw-r--r--inc/parser/xhtml.php80
1 files changed, 57 insertions, 23 deletions
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index b85aa911e..d85d04250 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -512,11 +512,10 @@ class Doku_Renderer_XHTML extends Doku_Renderer {
echo $this->__formatLink($link);
}
- /**
+ /*
* @deprecated not used!!!
* @TODO Correct the CSS class for files? (not windows)
* @TODO Remove hard coded URL to splitbrain.org
- */
function filelink($link, $title = NULL) {
echo '<a';
@@ -538,6 +537,7 @@ class Doku_Renderer_XHTML extends Doku_Renderer {
echo '</a>';
}
+ */
/**
* @TODO Remove hard coded URL to splitbrain.org
@@ -567,31 +567,65 @@ class Doku_Renderer_XHTML extends Doku_Renderer {
echo '</a>';
}
- /**
- * @TODO Protect email address from harvesters
- * @TODO Remove hard coded link to splitbrain.org
- */
- function email($address, $title = NULL) {
- echo '<a';
-
- $title = $this->__getLinkTitle($title, $address, $isImage);
-
+ function emaillink($address, $name = NULL) {
+ global $conf;
+ //simple setup
+ $link = array();
+ $link['target'] = '';
+ $link['pre'] = '';
+ $link['suf'] = '';
+ $link['style'] = '';
+ $link['more'] = '';
+
+ //we just test for image here - we need to encode the title our self
+ $this->__getLinkTitle($name, $address, $isImage);
if ( !$isImage ) {
- echo ' class="mail"';
+ $link['class']='mail';
} else {
- echo ' class="media"';
+ $link['class']='media';
+ }
+
+ //shields up
+ if($conf['mailguard']=='visible'){
+ //the mail name gets some visible encoding
+ $address = str_replace('@',' [at] ',$address);
+ $address = str_replace('.',' [dot] ',$address);
+ $address = str_replace('-',' [dash] ',$address);
+
+ $title = $this->__xmlEntities($address);
+ if(empty($name)){
+ $name = $this->__xmlEntities($address);
+ }else{
+ $name = $this->__xmlEntities($name);
+ }
+ }elseif($conf['mailguard']=='hex'){
+ //encode every char to a hex entity
+ for ($x=0; $x < strlen($address); $x++) {
+ $encode .= '&#x' . bin2hex($address[$x]).';';
+ }
+ $address = $encode;
+ $title = $encode;
+ if(empty($name)){
+ $name = $encode;
+ }else{
+ $name = $this->__xmlEntities($name);
+ }
+ }else{
+ //keep address as is
+ $title = $this->__xmlEntities($address);
+ if(empty($name)){
+ $name = $this->__xmlEntities($address);
+ }else{
+ $name = $this->__xmlEntities($name);
+ }
}
- echo ' href="mailto:'.$this->__xmlEntities($address).'"';
-
- echo ' style="background: transparent url(http://wiki.splitbrain.org/images/mail_icon.gif) 0px 1px no-repeat;"';
-
- echo ' onclick="return svchk()" onkeypress="return svchk()">';
-
- echo $title;
-
- echo '</a>';
-
+ $link['url'] = 'mailto:'.$address;
+ $link['name'] = $name;
+ $link['title'] = $title;
+
+ //output formatted
+ echo $this->__formatLink($link);
}
/**