Exemple #1
0
/**
 * Serves pages for twitter.
 *
 * @param array $page
 */
function twitter_api_pagehandler($page)
{
    if (!isset($page[0])) {
        forward();
    }
    switch ($page[0]) {
        case 'authorize':
            twitter_api_authorize();
            break;
        case 'revoke':
            twitter_api_revoke();
            break;
        case 'forward':
            twitter_api_forward();
            break;
        case 'login':
            twitter_api_login();
            break;
        case 'interstitial':
            gatekeeper();
            // only let twitter users do this.
            $guid = elgg_get_logged_in_user_guid();
            $twitter_name = elgg_get_plugin_user_setting('twitter_name', $guid, 'twitter_api');
            if (!$twitter_name) {
                register_error(elgg_echo('twitter_api:invalid_page'));
                forward();
            }
            $pages = dirname(__FILE__) . '/pages/twitter_api';
            include "{$pages}/interstitial.php";
            break;
        default:
            forward();
            break;
    }
}
Exemple #2
0
/**
 * Serves pages for twitter.
 *
 * @param array $page
 * @return bool
 */
function twitter_api_pagehandler($page)
{
    if (!isset($page[0])) {
        return false;
    }
    switch ($page[0]) {
        case 'authorize':
            twitter_api_authorize();
            break;
        case 'revoke':
            twitter_api_revoke();
            break;
        case 'forward':
            twitter_api_forward();
            break;
        case 'login':
            twitter_api_login();
            break;
        case 'interstitial':
            elgg_gatekeeper();
            // only let twitter users do this.
            $guid = elgg_get_logged_in_user_guid();
            $twitter_name = elgg_get_plugin_user_setting('twitter_name', $guid, 'twitter_api');
            if (!$twitter_name) {
                register_error(elgg_echo('twitter_api:invalid_page'));
                forward();
            }
            echo elgg_view('resources/twitter_api/interstitial');
            break;
        default:
            return false;
    }
    return true;
}
Exemple #3
0
/**
 * Serves pages for twitter.
 *
 * @param array$page
 */
function twitter_api_pagehandler($page)
{
    if (!isset($page[0])) {
        forward();
    }
    switch ($page[0]) {
        case 'authorize':
            twitter_api_authorize();
            break;
        case 'revoke':
            twitter_api_revoke();
            break;
        case 'forward':
            twitter_api_forward();
            break;
        case 'login':
            twitter_api_login();
            break;
        default:
            forward();
            break;
    }
}