|
Revision 126, 1.2 kB
(checked in by d0nut, 5 years ago)
|
|
modifications to support wcf update to 1.0.4
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | require_once(WCF_DIR.'lib/data/message/bbcode/BBCodeParser.class.php'); |
|---|
| 3 | require_once(WCF_DIR.'lib/data/message/bbcode/BBCode.class.php'); |
|---|
| 4 | |
|---|
| 5 | /** |
|---|
| 6 | * BBCode for [phpdoc] Tag |
|---|
| 7 | * |
|---|
| 8 | * @author Torben Brodt |
|---|
| 9 | * @package com.woltlab.wcf.data.message.bbcode |
|---|
| 10 | */ |
|---|
| 11 | class PHPDocBBCode implements BBCode { |
|---|
| 12 | protected $url = 'http://www.coder-suche.de/search.jsp?query=site:de.php.net+%s'; |
|---|
| 13 | |
|---|
| 14 | /** |
|---|
| 15 | * @param func |
|---|
| 16 | */ |
|---|
| 17 | protected function getSignature($func) { |
|---|
| 18 | // sql query |
|---|
| 19 | $sql = "SELECT signature |
|---|
| 20 | FROM wcf".WCF_N."_phpdoc |
|---|
| 21 | WHERE function = '".escapeString($func)."' "; |
|---|
| 22 | $row = WCF::getDB()->getFirstRow($sql); |
|---|
| 23 | return $row['signature']; |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | /** |
|---|
| 28 | * @see BBCode::getParsedTag() |
|---|
| 29 | */ |
|---|
| 30 | public function getParsedTag($openingTag, $content, $closingTag, BBCodeParser $parser) { |
|---|
| 31 | $url = sprintf($this->url, urlencode($content)); |
|---|
| 32 | |
|---|
| 33 | if ($parser->getOutputType() == 'text/html') { |
|---|
| 34 | $text = $content; |
|---|
| 35 | $signature = addslashes($this->getSignature($content)); |
|---|
| 36 | return '<a title="'.$signature.'" href="'.$url.'" style="background-image:url(\'wcf/icon/wysiwyg/phpdocM.png\');background-repeat:no-repeat;background-position:left;padding-left:25px">'.$text.'</a>'; |
|---|
| 37 | } |
|---|
| 38 | else if ($parser->getOutputType() == 'text/plain') { |
|---|
| 39 | return $url; |
|---|
| 40 | } |
|---|
| 41 | } |
|---|
| 42 | } |
|---|
| 43 | ?> |
|---|