diff --git a/examples/example.php b/examples/example.php index 4c22fa96..645adf2b 100644 --- a/examples/example.php +++ b/examples/example.php @@ -1,4 +1,9 @@ getLogoutUrl(); } else { - $statusUrl = $facebook->getLoginStatusUrl(); $loginUrl = $facebook->getLoginUrl(); } @@ -77,10 +81,6 @@ Logout -
- Check the login status using OAuth 2.0 handled by the PHP SDK: - Check the login status -
Login using OAuth 2.0 handled by the PHP SDK: Login with Facebook diff --git a/readme.md b/readme.md index ecbfffe3..4c920778 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,19 @@ -Facebook PHP SDK (v.3.2.3) +### New SDK Released + +We've released version 4 of the Facebook SDK for PHP here: [https://github.com/facebook/facebook-php-sdk-v4](https://github.com/facebook/facebook-php-sdk-v4) +Please use the new repository for new projects and contributions. +See the [Facebook Developers](https://developers.facebook.com/docs/php/) site + for documentation. + +----- + +----- + +----- + +----- + +Facebook PHP SDK (v.3.2.3) (DEPRECATED) The [Facebook Platform](http://developers.facebook.com/) is a set of APIs that make your app more social. diff --git a/src/base_facebook.php b/src/base_facebook.php index b9d403ef..95e18fb1 100644 --- a/src/base_facebook.php +++ b/src/base_facebook.php @@ -659,21 +659,6 @@ public function getLogoutUrl($params=array()) { ); } - /** - * Get a login status URL to fetch the status from Facebook. - * - * @param array $params Provide custom parameters - * @return string The URL for the logout flow - */ - public function getLoginStatusUrl($params=array()) { - return $this->getLoginUrl( - array_merge(array( - 'response_type' => 'code', - 'display' => 'none', - ), $params) - ); - } - /** * Make an API call. * diff --git a/src/facebook.php b/src/facebook.php index 51de333b..b6b827dc 100644 --- a/src/facebook.php +++ b/src/facebook.php @@ -55,7 +55,8 @@ class Facebook extends BaseFacebook * @see BaseFacebook::__construct */ public function __construct($config) { - if (!session_id()) { + if ((function_exists('session_status') + && session_status() !== PHP_SESSION_ACTIVE) || !session_id()) { session_start(); } parent::__construct($config); diff --git a/tests/tests.php b/tests/tests.php index b28a3f18..fa1d83a7 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -761,37 +761,6 @@ public function testLogoutURLDefaults() { $this->assertFalse(strpos($facebook->getLogoutUrl(), self::SECRET)); } - public function testLoginStatusURLDefaults() { - $_SERVER['HTTP_HOST'] = 'fbrell.com'; - $_SERVER['REQUEST_URI'] = '/examples'; - $facebook = new TransientFacebook(array( - 'appId' => self::APP_ID, - 'secret' => self::SECRET, - )); - $encodedUrl = rawurlencode('http://fbrell.com/examples'); - $this->assertNotNull(strpos($facebook->getLoginStatusUrl(), $encodedUrl), - 'Expect the current url to exist.'); - } - - public function testLoginStatusURLCustom() { - $_SERVER['HTTP_HOST'] = 'fbrell.com'; - $_SERVER['REQUEST_URI'] = '/examples'; - $facebook = new TransientFacebook(array( - 'appId' => self::APP_ID, - 'secret' => self::SECRET, - )); - $encodedUrl1 = rawurlencode('http://fbrell.com/examples'); - $okUrl = 'http://fbrell.com/here1'; - $encodedUrl2 = rawurlencode($okUrl); - $loginStatusUrl = $facebook->getLoginStatusUrl(array( - 'ok_session' => $okUrl, - )); - $this->assertNotNull(strpos($loginStatusUrl, $encodedUrl1), - 'Expect the current url to exist.'); - $this->assertNotNull(strpos($loginStatusUrl, $encodedUrl2), - 'Expect the custom url to exist.'); - } - public function testNonDefaultPort() { $_SERVER['HTTP_HOST'] = 'fbrell.com:8080'; $_SERVER['REQUEST_URI'] = '/examples';