Skip to content

Commit

Permalink
Transferred
Browse files Browse the repository at this point in the history
  • Loading branch information
bharaththiruveedula-zz committed Sep 23, 2012
0 parents commit 41ab7fc
Show file tree
Hide file tree
Showing 17 changed files with 926 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
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
49 changes: 49 additions & 0 deletions AppInfo.php
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;
}

}
39 changes: 39 additions & 0 deletions Readme.md
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.

1 change: 1 addition & 0 deletions channel.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script src="//connect.facebook.net/en_US/all.js"></script>
Binary file added images/fpo-picture.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/get-started-bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/header-sketch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/picture-sketch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/samples-bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/sprites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 41ab7fc

Please sign in to comment.