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
function wnet_get_transient_remote_json($transientname, $url, $interval=1800) { | |
// those are the same arguments as 'set_transient()' | |
$stalecachename = 'stalecache_' . $transientname; | |
// we generate a consistent name for the backup data | |
if ( false === ( $json = get_transient($transientname) ) ) { | |
$response = wp_remote_get($url); | |
// get the remote data as before, but this time... |
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
I blog at ieg.wnet.org/author/tamw | |
Thorough guide to OAuth in WordPress, with code examples: | |
http://ieg.wnet.org/2015/08/using-oauth-in-wordpress-plugin-part-1-the-basics/ | |
Walkthrough of how we do OAuth on thirteen.org: | |
http://ieg.wnet.org/2016/04/pbs-logins-thirteen-org-thirteen-passport/ | |
My complete presentation on slideshare | |
http://www.slideshare.net/WilliamTam13/integrating-oauth-and-social-login-into-wordpress-64172056 |
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 | |
/* | |
* Plugin Name: Foo oAuth Demo | |
* Version: 2 | |
* Plugin URI: http://ieg.wnet.org/ | |
* Description: A simple Google oAuth demo plugin | |
* Author: William Tam | |
* Author URI: http://ieg.wnet.org/blog/author/tamw/ | |
* Requires at least: 3.6 | |
* Tested up to: 4.2.2 |
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 | |
/* | |
* Plugin Name: Foo oAuth Demo | |
* Version: 1 | |
* Plugin URI: http://ieg.wnet.org/ | |
* Description: A simple Google oAuth demo plugin | |
* Author: William Tam | |
* Author URI: http://ieg.wnet.org/blog/author/tamw/ | |
* Requires at least: 3.6 | |
* Tested up to: 4.2.2 |