-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.php
67 lines (48 loc) · 1.33 KB
/
helper.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
58
59
60
61
62
63
64
65
66
67
<?php
/**
* @copyright Copyright (c) 2015 R2H (http://www.r2h.nl). All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// no direct access
defined('_JEXEC') or die;
/**
* R2H - FB Page Plugin Helper Class.
*
* @package Joomla.Site
* @subpakage r2h.fbpageplugin
*/
class modR2H_fbpagepluginHelper {
public static function constructScript(&$params) {
$fb_appid = $params->get('fb_appid', 'XXXXXXXXXXXXXXXX');
$fb_script = "
window.fbAsyncInit = function() {
FB.init({
appId : '" . $fb_appid . "',
xfbml : true,
version : 'v2.3'
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = \"//connect.facebook.net/en_US/sdk.js\";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));";
return $fb_script;
}
public static function checkWidth(&$params) {
$fb_width = $params->get('fb_width', 500);
if( ($fb_width <= 180) || ($fb_width >= 500)) {
$fb_width = 500;
}
return $fb_width;
}
public static function checkHeight(&$params) {
$fb_height = $params->get('fb_height', 200);
if($fb_height <= 130) {
$fb_height = 200;
}
return $fb_height;
}
}