-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 41ab7fc
Showing
17 changed files
with
926 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "sdk"] | ||
path = sdk | ||
url = https://github.com/facebook/facebook-php-sdk.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
/** | ||
* This class provides static methods that return pieces of data specific to | ||
* your app | ||
*/ | ||
class AppInfo { | ||
|
||
/***************************************************************************** | ||
* | ||
* These functions provide the unique identifiers that your app users. These | ||
* have been pre-populated for you, but you may need to change them at some | ||
* point. They are currently being stored in 'Environment Variables'. To | ||
* learn more about these, visit | ||
* 'http://php.net/manual/en/function.getenv.php' | ||
* | ||
****************************************************************************/ | ||
|
||
/** | ||
* @return the appID for this app | ||
*/ | ||
public static function appID() { | ||
return getenv('FACEBOOK_APP_ID'); | ||
} | ||
|
||
/** | ||
* @return the appSecret for this app | ||
*/ | ||
public static function appSecret() { | ||
return getenv('FACEBOOK_SECRET'); | ||
} | ||
|
||
/** | ||
* @return the url | ||
*/ | ||
public static function getUrl($path = '/') { | ||
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) | ||
|| isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' | ||
) { | ||
$protocol = 'https://'; | ||
} | ||
else { | ||
$protocol = 'http://'; | ||
} | ||
|
||
return $protocol . $_SERVER['HTTP_HOST'] . $path; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Facebook/Heroku sample app -- PHP | ||
================================= | ||
|
||
This is a sample app showing use of the Facebook Graph API, written in PHP, designed for deployment to [Heroku](http://www.heroku.com/). | ||
|
||
Run locally | ||
----------- | ||
|
||
Configure Apache with a `VirtualHost` that points to the location of this code checkout on your system. | ||
|
||
[Create an app on Facebook](https://developers.facebook.com/apps) and set the Website URL to your local VirtualHost. | ||
|
||
Copy the App ID and Secret from the Facebook app settings page into your `VirtualHost` config, something like: | ||
|
||
<VirtualHost *:80> | ||
DocumentRoot /Users/adam/Sites/myapp | ||
ServerName myapp.localhost | ||
SetEnv FACEBOOK_APP_ID 12345 | ||
SetEnv FACEBOOK_SECRET abcde | ||
</VirtualHost> | ||
|
||
Restart Apache, and you should be able to visit your app at its local URL. | ||
|
||
Deploy to Heroku via Facebook integration | ||
----------------------------------------- | ||
|
||
The easiest way to deploy is to create an app on Facebook and click Cloud Services -> Get Started, then choose PHP from the dropdown. You can then `git clone` the resulting app from Heroku. | ||
|
||
Deploy to Heroku directly | ||
------------------------- | ||
|
||
If you prefer to deploy yourself, push this code to a new Heroku app on the Cedar stack, then copy the App ID and Secret into your config vars: | ||
|
||
heroku create --stack cedar | ||
git push heroku master | ||
heroku config:add FACEBOOK_APP_ID=12345 FACEBOOK_SECRET=abcde | ||
|
||
Enter the URL for your Heroku app into the Website URL section of the Facebook app settings page, hen you can visit your app on the web. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<script src="//connect.facebook.net/en_US/all.js"></script> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.