[dokuwiki] Re: AFP links & PHP includes
- From: Alex Torrance <alex@xxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Fri, 24 Jun 2005 17:42:13 +0100
No promise to include them but I'd like to have a look at the code.
This isn't a proper patch (darcs is still compiling) but here are the
additions to the code.
If you want me to send a proper patch please let me know.
Alex
conf/dokuwiki.php: line 77
$conf['target']['apple'] = '';
inc/parserutils: line 208
$Parser->addMode('applesharelink',new Doku_Parser_Mode_AppleShareLink());
inc/parser/handler.php: line 355
function internallink($match, $state, $pos) {
// Strip the opening and closing markup
$link = preg_replace(array('/^\[\[/','/\]\]$/u'),'',$match);
// Split title from URL
$link = preg_split('/\|/u',$link,2);
if ( !isset($link[1]) ) {
$link[1] = NULL;
} else if ( preg_match('/^\{\{[^\}]+\}\}$/',$link[1]) ) {
// If the title is an image, convert it to an array containing the
image details
$link[1] = Doku_Handler_Parse_Media($link[1]);
}
$link[0] = trim($link[0]);
//decide which kind of link it is
if ( preg_match('/^[a-zA-Z]+>{1}.+$/u',$link[0]) ) {
// Interwiki
$interwiki = preg_split('/>/u',$link[0]);
$this->_addCall(
'interwikilink',
array($link[0],$link[1],strtolower($interwiki[0]),$interwiki[1]),
$pos
);
}elseif ( preg_match('/^\\\\\\\\[\w.:?\-;,]+?\\\\/u',$link[0]) ) {
// Windows Share
$this->_addCall(
'windowssharelink',
array($link[0],$link[1]),
$pos
);
}elseif (
preg_match('#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i',$link[0]) ) {
// E-Mail
$this->_addCall(
'emaillink',
array($link[0],$link[1]),
$pos
);
}elseif ( preg_match('#^afp://#i',$link[0]) ) {
// apple share link
$this->_addCall(
'applesharelink',
array($link[0],$link[1]),
$pos
);
}elseif ( preg_match('#^([a-z0-9]+?)://#i',$link[0]) ) {
// external link (accepts all protocols)
$this->_addCall(
'externallink',
array($link[0],$link[1]),
$pos
);
}elseif ( preg_match('!^#.+!',$link[0]) ){
// local link
$this->_addCall(
'locallink',
array(substr($link[0],1),$link[1]),
$pos
);
}else{
// internal link
$this->_addCall(
'internallink',
array($link[0],$link[1]),
$pos
);
}
return TRUE;
}
inc/parser/handler.php: line 431
function applesharelink($match, $state, $pos) {
$this->_addCall('applesharelink', array($match), $pos);
return TRUE;
}
inc/parser/parser.php: line 687
//-------------------------------------------------------------------
class Doku_Parser_Mode_AppleShareLink extends Doku_Parser_Mode {
var $pattern;
function preConnect() {
$ltrs = '\w';
$gunk = '/\#~:.?+=&%@!\-';
$punc = '.:?\-;,';
$host = $ltrs.$punc;
$any = $ltrs.$gunk.$punc;
$this->pattern =
'\b(?i)'.'afp'.'(?-i)://['.$any.']+?(?=['.$punc.']*[^'.$any.'])';
}
function connectTo($mode) {
$this->Lexer->addSpecialPattern($this->pattern, $mode,
'applesharelink');
}
}
/inc/parser/parser.php: line 843
// Modes where the token is simply replaced - contain no
// other modes
function Doku_Parser_Substition() {
$modes = array(
'acronym','smiley','wordblock','entity','camelcaselink',
'internallink','media','externallink','linebreak','emaillink',
'windowssharelink','filelink','notoc','nocache','multiplyentity',
'quotes','rss','applesharelink',
);
return $modes;
}
inc/parser/xhtml.php: line 616
function applesharelink($url, $name = NULL) {
global $conf;
global $lang;
//simple setup
$link['target'] = $conf['target']['apple'];
$link['pre'] = '';
$link['suf'] = '';
$link['style'] = '';
// Strip last section of URL as name
if ($name == NULL) {
preg_match('/\/([a-zA-Z0-9\-_.]+)\/?$/',
htmlspecialchars($url), $filename);
$link['name'] = $filename[1];
} else {
$link['name'] = $name;
}
$link['class'] = 'apple';
$link['title'] = $this->_xmlEntities($url);
$link['url'] = $url;
//output formatted
$this->doc .= $this->_formatLink($link);
}
tpl/default/design.css: line 190
/* afp link */
a.apple {
background: transparent url(images/apple.gif) 0px 1px no-repeat;
padding: 1px 0px 1px 16px;
}
- References:
- [dokuwiki] AFP links & PHP includes
- From: Alex Torrance
- [dokuwiki] Re: AFP links & PHP includes
- From: Andreas Gohr
Other related posts:
- » [dokuwiki] AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- » [dokuwiki] Re: AFP links & PHP includes
- [dokuwiki] AFP links & PHP includes
- From: Alex Torrance
- [dokuwiki] Re: AFP links & PHP includes
- From: Andreas Gohr