-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathe_header.php
More file actions
93 lines (74 loc) · 2.41 KB
/
Copy pathe_header.php
File metadata and controls
93 lines (74 loc) · 2.41 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* @file
* Class instantiation to prepare JavaScript configurations and include css/js
* files to page header.
*/
if(!defined('e107_INIT'))
{
exit;
}
// Load required main class of plugin.
require_once("classes/fb_chat_main.class.php");
// Use [PLUGINS]/fb_chat/languages/[LANGUAGE]/[LANGUAGE]_front.php file.
e107::lan('fb_chat', false, true);
/**
* Class fb_chat_e_header.
*/
class fb_chat_e_header extends fb_chat_main
{
protected $plugPrefs = array();
private $jsOptions = "";
function __construct()
{
$this->plugPrefs = e107::getPlugConfig('fb_chat')->getPref();
if(!$this->check_permission())
{
return;
}
$this->get_js_options();
$this->include_components();
}
/**
* Get chat settings and language texts for JavaScript
*/
function get_js_options()
{
$conf = $this->plugPrefs;
// Pass default chat configs to JavaScript
$this->jsOptions['linkClass'] = vartrue($conf['fb_chat_launch'], 'fbcLaunch');
$this->jsOptions['requestPath'] = e_PLUGIN_ABS . 'fb_chat';
$this->jsOptions['heartbeatMin'] = vartrue($conf['fb_chat_hb_min'], 3) * 1000;
$this->jsOptions['heartbeatMax'] = vartrue($conf['fb_chat_hb_max'], 30) * 1000;
$this->jsOptions['heartbeatMenu'] = vartrue($conf['fb_chat_hb_menu'], 30) * 1000;
$this->jsOptions['floatMenu'] = vartrue($conf['fb_chat_fm'], 1);
$this->jsOptions['status'] = $this->get_chat_status(USERID);
// Pass language texts to JavaScript
$this->jsOptions['lans'] = array(
'online' => LANF_FB_CHAT_04,
'offline' => LANF_FB_CHAT_05,
'turnon' => LANF_FB_CHAT_07,
'turnoff' => LANF_FB_CHAT_06,
'offmsg' => LANF_FB_CHAT_08,
'nouser' => LANF_FB_CHAT_09,
);
}
/**
* Include necessary CSS and JS files
*/
function include_components()
{
$inlineJS = '$(document).fb_chat(' . $this->fb_chat_json_encode($this->jsOptions) . ');';
$inlineJS = '$(document).ready(function() { ' . $inlineJS . ' });';
e107::css('fb_chat', 'css/fb_chat.css');
e107::css('fb_chat', 'css/fb_chat_screen.css');
e107::css('fb_chat', 'css/fb_chat_screen_ie.css', null, 'all', '<!--[if lte IE 7]>', '<![endif]-->');
// TODO: Need to fix bootstrap theme's CSS style because of chat wrapper.
// TODO: Make an option on Admin UI for this.
//e107::css('fb_chat', 'css/fix/fb_chat__bootstrap.css');
e107::js('fb_chat', 'js/fb_chat.js', 'jquery');
e107::js('inline', $inlineJS, 'jquery');
}
}
// Class instantiation.
new fb_chat_e_header;