source: trunk/www.guidonia.net/wp/wp-content/plugins/fbconnect/fbConfig.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 1.7 KB
Line 
1<?php
2/**
3 * @author: Javier Reyes Gomez (http://www.sociable.es)
4 * @date: 05/10/2008
5 * @license: GPLv2
6 */
7if (version_compare("5", phpversion(),"<")){
8 include_once 'facebook-client/facebook.php';
9 include_once 'fbConfig_php5.php';
10}else{
11 include_once 'facebook-client4/facebook.php';
12 include_once 'fbConfig_php4.php';
13}
14
15function is_config_setup() {
16 return (get_api_key() && get_api_secret() &&
17 get_api_key() != 'YOUR_API_KEY' &&
18 get_api_secret() != 'YOUR_API_SECRET');
19}
20
21// Whether the site is "connected" or not
22function is_fbconnect_enabled() {
23 if (!is_config_setup()) {
24 return false;
25 }
26
27 // Change this if you want to turn off Facebook connect
28 return true;
29}
30function get_api_key() {
31 if (isset($_POST['fb_api_key']) && $_POST['fb_api_key']!=""){
32 return $_POST['fb_api_key'];
33 }else{
34 return get_option('fb_api_key');
35 }
36}
37function get_api_secret() {
38 if (isset($_POST['fb_api_secret']) && $_POST['fb_api_secret']!=""){
39 return $_POST['fb_api_secret'];
40 }else{
41 return get_option('fb_api_secret');
42 }
43
44}
45
46function get_base_fb_url() {
47 return "connect.facebook.com";
48}
49
50function get_ssl_root() {
51 return 'https://www.'.get_base_fb_url();
52}
53
54
55function get_static_root() {
56 return 'http://static.ak.'.get_base_fb_url();
57}
58
59
60function get_feed_bundle_id() {
61 return get_option('fb_templates_id');
62}
63
64/*
65 * Get the facebook client object for easy access.
66 */
67function facebook_client() {
68 static $facebook = null;
69 $api_key = get_api_key();
70 $api_secret = get_api_secret();
71 if ($facebook === null && $api_key!="" && $api_secret!="") {
72 $facebook = new Facebook($api_key, $api_secret, false, get_base_fb_url());
73 }
74 return $facebook;
75}
76
Note: See TracBrowser for help on using the repository browser.