-
-
Save ptim/5569544 to your computer and use it in GitHub Desktop.
!!! WARNING!! THIS EXPOSES YOUR PRIVATE TWITTER API KEYS AND SECRETS !!! You'll need to regenerate the keys as soon as you make them public:
https://dev.twitter.com/apps/
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
<?php | |
/* | |
Debug shortcode for Twitget. | |
!!! WARNING!! THIS EXPOSES YOUR PRIVATE TWITTER API KEYS AND SECRETS !!! | |
You'll need to regenerate the keys as soon as you make them public: | |
https://dev.twitter.com/apps/ | |
To use: | |
- paste this code into the very bottom of the file twitget.php ( after ?> ) | |
- create a private post | |
- enter the shortcode [twitget-debug] | |
*/ | |
if(!class_exists('tmhOAuth')) { | |
return "Twitget is not active"; | |
} | |
add_shortcode('twitget-debug', 'twitget_debug_shortcode_handler'); | |
// Debug function | |
function twitget_debug_shortcode_handler($attributes, $content = null) { | |
$options = get_option('twitget_settings'); | |
$tmhOAuth = new tmhOAuth( | |
array( | |
'consumer_key' => $options['consumer_key'], | |
'consumer_secret' => $options['consumer_secret'], | |
'user_token' => $options['user_token'], | |
'user_secret' => $options['user_secret'], | |
'curl_ssl_verifypeer' => false | |
) | |
); | |
ob_start(); | |
$code = $tmhOAuth->request('GET', $tmhOAuth->url('1/account/verify_credentials')); | |
if ($code == 200) { | |
echo 'The access level of this token is: ' . $tmhOAuth->response['headers']['x_access_level'] . PHP_EOL; | |
tmhUtilities::pr($tmhOAuth->response); | |
} else { | |
tmhUtilities::pr(htmlentities($tmhOAuth->response['response'])); | |
} | |
echo "\n\n========================================\n\n"; | |
var_dump($tmhOAuth); | |
$dataDump = ob_get_clean(); | |
return '<pre>'. $dataDump . '</pre>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment