FacebookBridge plugin - allow Facebook app ID and secret to be

initialized via config.php
This commit is contained in:
Zach Copley 2011-02-09 04:49:39 +00:00
parent 91485718c4
commit 98af8d2a19
1 changed files with 26 additions and 3 deletions

View File

@ -24,7 +24,7 @@
* @category Pugin * @category Pugin
* @package StatusNet * @package StatusNet
* @author Zach Copley <zach@status.net> * @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet, Inc. * @copyright 2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
@ -47,8 +47,9 @@ define("FACEBOOK_SERVICE", 2);
*/ */
class FacebookBridgePlugin extends Plugin class FacebookBridgePlugin extends Plugin
{ {
public $appId = null; // Facebook application ID public $appId; // Facebook application ID
public $secret = null; // Facebook application secret public $secret; // Facebook application secret
public $facebook = null; // Facebook application instance public $facebook = null; // Facebook application instance
public $dir = null; // Facebook plugin dir public $dir = null; // Facebook plugin dir
@ -61,6 +62,28 @@ class FacebookBridgePlugin extends Plugin
*/ */
function initialize() function initialize()
{ {
// Allow the id and key to be passed in
// Control panel will override
if (isset($this->appId)) {
$appId = common_config('facebook', 'appid');
if (empty($appId)) {
Config::save(
'facebook',
'appid',
$this->appId
);
}
}
if (isset($this->secret)) {
$secret = common_config('facebook', 'secret');
if (empty($secret)) {
Config::save('facebook', 'secret', $this->secret);
}
}
$this->facebook = Facebookclient::getFacebook( $this->facebook = Facebookclient::getFacebook(
$this->appId, $this->appId,
$this->secret $this->secret