<commit_before><?php
define('FACEBOOK_SDK_V4_SRC_DIR', dirname(__FILE__) . '/facebook-php-sdk-v4-4.0-dev/src/Facebook/');
include(dirname(__FILE__) . '/lib/facebook-php-sdk-v4-4.0-dev/autoload.php');

define('FB_APP_ID',     'YOUR_APP_ID');
define('FB_APP_SECRET', 'YOUR_APP_SECRET');

define('IS_CLI', is_cli());
if (!IS_CLI)
    session_start(); // for facebook

use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
FacebookSession::setDefaultApplication(FB_APP_ID, FB_APP_SECRET);

// {{{ function is_cli()
function is_cli()
{
    return (php_sapi_name() === 'cli') ? true : false;
}
// }}}
?><commit_msg>add gen_facebook_login_url()<commit_after><?php
define('FACEBOOK_SDK_V4_SRC_DIR', dirname(__FILE__) . '/facebook-php-sdk-v4-4.0-dev/src/Facebook/');
include(dirname(__FILE__) . '/lib/facebook-php-sdk-v4-4.0-dev/autoload.php');

define('FB_APP_ID',     'YOUR_APP_ID');
define('FB_APP_SECRET', 'YOUR_APP_SECRET');

define('IS_CLI', is_cli());
if (!IS_CLI)
    session_start(); // for facebook

use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
FacebookSession::setDefaultApplication(FB_APP_ID, FB_APP_SECRET);

// {{{ function is_cli()
function is_cli()
{
    return (php_sapi_name() === 'cli') ? true : false;
}
// }}}
// {{{ function gen_facebook_login_url($from = '')
function gen_facebook_login_url($from = '')
{
    $redirect_uri = 'http://' . YOUR_HOSTNAME . '/login.php?from=' . urlencode($from);
    $fbrdhelper   = new \Facebook\FacebookRedirectLoginHelper($redirect_uri);
    $fb_login_url = $fbrdhelper->getLoginUrl(array('email'));

    return $fb_login_url;
}
// }}}
?>
{'fraction_non_alphanumeric': 0.1779318313113807, 'fraction_numerical': 0.008087810514153668, 'mean_word_length': 5.687258687258687, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5163057', 'n_tokens_mistral': 658, 'n_tokens_neox': 636, 'n_words': 89}