root/bbcode.adsense/files/lib/data/message/bbcode/AdSenseBBCode.class.php @ 129

Revision 129, 1.0 kB (checked in by d0nut, 5 years ago)

fixed adsense code to version 1.0.1
now in usage in easy-coding

Line 
1<?php
2require_once(WCF_DIR.'lib/data/message/bbcode/BBCodeParser.class.php');
3require_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 */
12class 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">//<![CDATA[
30'.$content.'
31//]]></script>
32<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
33
34                }
35                else if ($parser->getOutputType() == 'text/plain') {
36                        return $content;
37                }
38        }
39}
40?>
Note: See TracBrowser for help on using the browser.