|
Revision 114, 1.0 kB
(checked in by d0nut, 6 years ago)
|
|
initial release of adsense bbcode
|
| 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 | * Provides a adsense bbcode |
|---|
| 7 | * usage: [adsense]optionaler-code[/adsense] |
|---|
| 8 | * |
|---|
| 9 | * @author Torben Brodt |
|---|
| 10 | * @package de.easy-coding.wcf.data.message.bbcode |
|---|
| 11 | */ |
|---|
| 12 | class AdSenseBBCode implements BBCode { |
|---|
| 13 | |
|---|
| 14 | /** |
|---|
| 15 | * @see BBCode::getParsedTag() |
|---|
| 16 | */ |
|---|
| 17 | public function getParsedTag($openingTag, $content, $closingTag, BBCodeParser $parser) { |
|---|
| 18 | |
|---|
| 19 | if(strlen($content) > 0) { |
|---|
| 20 | if(WCF::getUser()->getPermission('user.board.canAdsense') == false) { |
|---|
| 21 | return WCF::getLanguage()->get('wcf.acp.group.option.user.board.canAdsense.error'); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | } else { |
|---|
| 25 | $content = MESSAGE_BBCODE_ADSENSE; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | if ($parser->getOutputType() == 'text/html') { |
|---|
| 29 | return '<script type="text/javascript"> |
|---|
| 30 | <![CDATA[ |
|---|
| 31 | '.$content.' |
|---|
| 32 | ]]> |
|---|
| 33 | </script> |
|---|
| 34 | <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>'; |
|---|
| 35 | } |
|---|
| 36 | else if ($parser->getOutputType() == 'text/plain') { |
|---|
| 37 | return $content; |
|---|
| 38 | } |
|---|
| 39 | } |
|---|
| 40 | } |
|---|
| 41 | ?> |
|---|