diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-05-27 14:51:52 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-05-27 14:51:52 -0400 |
commit | f59ab5dc40862b141ee5463fd4d24b0d213a96f2 (patch) | |
tree | 4bdf4a00c75f8ac43fc1a052ba265d3020dbe4ae /lib | |
parent | 74b08bff53b614a0d3da56e848940cd3e9ca70ce (diff) | |
parent | 2b81dcb25329c496c7c4f2c99334b79ba0421c1e (diff) |
Merge branch '0.7.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.7.x
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facebookutil.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/facebookutil.php b/lib/facebookutil.php index ec3987273..242d2e06f 100644 --- a/lib/facebookutil.php +++ b/lib/facebookutil.php @@ -27,9 +27,21 @@ define("FACEBOOK_PROMPTED_UPDATE_PREF", 2); function getFacebook() { + static $facebook = null; + $apikey = common_config('facebook', 'apikey'); $secret = common_config('facebook', 'secret'); - return new Facebook($apikey, $secret); + + if ($facebook === null) { + $facebook = new Facebook($apikey, $secret); + } + + if (!$facebook) { + common_log(LOG_ERR, 'Could not make new Facebook client obj!', + __FILE__); + } + + return $facebook; } function updateProfileBox($facebook, $flink, $notice) { @@ -92,7 +104,6 @@ function isFacebookBound($notice, $flink) { } - function facebookBroadcastNotice($notice) { $facebook = getFacebook(); |