-
Notifications
You must be signed in to change notification settings - Fork 0
/
broziechat.php
57 lines (44 loc) · 1.67 KB
/
broziechat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/*------------------------------------------------------------------------
# plg_broziechat - Brozie Chat
# ------------------------------------------------------------------------
# author brozie.com
# copyright Copyright (C) Brozie - All rights reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.brozie.com
# Technical Support: Forum - http://developers.brozie.com
-------------------------------------------------------------------------*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
class plgSystemBroziechat extends JPlugin {
function onAfterRender() {
$app = JFactory::getApplication();
if(!$app->isSite()) return true;
$output = JResponse::getBody();
$colorscheme = $this->params->get('colorscheme', '');
$width = $this->params->get('width', '650');
$height = $this->params->get('height', '300');
$direction = $this->params->get('direction', '');
$r = '<script>
(function(d,w,o,s,t){
s=d.createElement("script");
s.src="//d2qfrhunzv3jwi.cloudfront.net/static/widget/brozie-widget.js";
s.async=true;
s.onload=s.onreadystatechange=function(r){
r=this.readyState;
if((r==null||(/complete|loaded/).test(r))&&((t=w.brozieWidget)&&(t=t.widgetChat)))t.init(o);
};
(d.head||d.body).appendChild(s);
})(document,window,{';
if(!empty($colorscheme)) $r.=' skin:\''.$colorscheme.'\',';
if(!empty($direction)) $r.=' dir:\''.$direction.'\',';
$r.= ' width:\''.$width.'\',
height:\''.$height.'\'
});
</script>';
$output = preg_replace('/<\/body>/i', $r.'</body>', $output);
JResponse::setBody($output);
return true;
}
}