root/bbcode.gadget/files/lib/data/message/bbcode/GadgetBBCode.class.php @ 741

Revision 741, 2.0 kB (checked in by d0nut, 4 years ago)

finalized gadget bbcode - added lots of translations

  • Property svn:executable set to *
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 * BBCode for [gadget] Tag
7 *
8 * @author      Torben Brodt
9 * @package     com.woltlab.wcf.data.message.bbcode.gadget
10 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html>
11 */
12class GadgetBBCode implements BBCode {
13        /**
14         * @see BBCode::getParsedTag()
15         */
16        public function getParsedTag($openingTag, $content, $closingTag, BBCodeParser $parser) {
17                $params = isset($openingTag['attributes'][0]) ? explode(',', $openingTag['attributes'][0]) : array('100%');
18                $pos = strpos($params[0], '%');
19                $width = $pos === false ? intval($params[0]).'px' : intval(substr($params[0],0,$pos)).'%';
20               
21                $myid = StringUtil::getRandomID();
22
23                $code = "<!-- Include the Google Friend Connect javascript library. -->
24<script type=\"text/javascript\" src=\"http://www.google.com/friendconnect/script/friendconnect.js\"></script>
25
26<!-- Define the div tag where the gadget will be inserted. -->
27<div id=\"div-".$myid."\" style=\"width:".$width.";border:1px solid #cccccc;\"></div>
28<!-- Render the gadget into a div. -->
29<script type=\"text/javascript\">
30var skin = {};
31skin['BORDER_COLOR'] = '#cccccc';
32skin['ENDCAP_BG_COLOR'] = '#e0ecff';
33skin['ENDCAP_TEXT_COLOR'] = '#333333';
34skin['ENDCAP_LINK_COLOR'] = '#0000cc';
35skin['ALTERNATE_BG_COLOR'] = '#ffffff';
36skin['CONTENT_BG_COLOR'] = '#ffffff';
37skin['CONTENT_LINK_COLOR'] = '#0000cc';
38skin['CONTENT_TEXT_COLOR'] = '#333333';
39skin['CONTENT_SECONDARY_LINK_COLOR'] = '#7777cc';
40skin['CONTENT_SECONDARY_TEXT_COLOR'] = '#666666';
41skin['CONTENT_HEADLINE_COLOR'] = '#333333';
42google.friendconnect.container.setParentUrl('/' /* location of rpc_relay.html and canvas.html */);
43google.friendconnect.container.renderOpenSocialGadget(
44 { id: 'div-".$myid."',
45   url:'".$content."',
46   site: '".GOOGLE_FRIENDCONNECT."'},
47  skin);
48</script>";
49
50                if ($parser->getOutputType() == 'text/html') {
51                        return $code;
52                }
53                else if ($parser->getOutputType() == 'text/plain') {
54                        return $content;
55                }
56        }
57}
58?>
Note: See TracBrowser for help on using the browser.