/*
Plugin Name: WP Flickr Post Bar
Plugin URI: http://tantannoodles.com/toolkit/wp-flickr-post-bar/
Description: Displays a Flickr bar at the top of your edit screen, which allows you to easily add Flickr photos to your posts with one click. Configure...
Version: 0.5
Author: Joe Tan
Author URI: http://tantannoodles.com/
Copyright (C) 2005 Joe Tan
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* ******************************************************************
Front end display functions
****************************************************************** */
/*
Prints HTML code where badge should be displayed
*/
function tantan_fpbFormDisplay() {
//$photos = tantan_fpbGetData();
//$tantan_fpbSize = get_option('tantan_fpbSize');
//$tantan_flickrMaxPhotos = get_option('tantan_flickrMaxPhotos');
//if (!$tantan_fpbSize) $tantan_fpbSize = 'Small';
$html =
"
";
// $html .= "";
echo $html;
// include(dirname(__FILE__).'/post-bar-form.html');
}
/*
Retrieve Flickr data
*/
function tantan_fpbGetData() {
// check to see if data is cached
$lastTimestamp = get_option('tantan_fpbTimestamp');
$photos = get_option('tantan_fpbPhotos');
$cached = false;
if ((is_array($photos) && count($photos) && $lastTimestamp && ((time() - $lastTimestamp) < 60*60))) {
// data is cached and still fresh, so don't do anything
$cached = true;
}
if (!$cached) {
include_once(dirname(__FILE__).'/lib.flickrBadge.php');
// not cached, so get data from flickr and update
$badge = new TanTanBadge();
$badge->setFlickrAPI(get_option('tantan_flickrAPI'));
$photos = $badge->getData(get_option('tantan_flickrUser'), get_option('tantan_flickrMaxPhotos'));
if (!is_array($photos) || (count($photos) == 0)) { // some sort of error
update_option('tantan_fpbPhotos', false);
} else {
update_option('tantan_fpbPhotos', $photos);
update_option('tantan_fpbTimestamp', time());
}
}
if (is_array($photos)) {
return $photos;
} else {
return array();
}
}
/* ******************************************************************
Admin options
****************************************************************** */
/*
Add hooks for admin page options
*/
function tantan_fpbAdminOptions() {
add_options_page('Flickr Post Bar', 'Flickr Post Bar', 10, __FILE__, 'tantan_fpbAdminPage');
}
/*
Admin page controller
*/
function tantan_fpbAdminPage() {
if (isset($_POST['tantan_action'])) {
update_option('tantan_flickrAPI', $_POST['tantan_flickrAPI']);
update_option('tantan_flickrUser', $_POST['tantan_flickrUser']);
update_option('tantan_flickrMaxPhotos',$_POST['tantan_flickrMaxPhotos']);
update_option('tantan_fpbSize', $_POST['tantan_fpbSize']);
update_option('tantan_fbpLinkDest', $_POST['tantan_fbpLinkDest']);
update_option('tantan_fbpLinkDestValue', $_POST['tantan_fbpLinkDestValue']);
update_option('tantan_fpbAutoLoadDisabled', $_POST['tantan_fpbAutoLoadDisabled']);
$status = "Saved settings.";
if ($_POST['tantan_clearCache'] == 'yes') {
update_option('tantan_fpbPhotos', false);
$status .= " Cleared cache.";
}
} else {
$status = "";
}
$tantan_flickrAPI = get_option('tantan_flickrAPI');
$tantan_flickrUser = get_option('tantan_flickrUser');
$tantan_flickrMaxPhotos = get_option('tantan_flickrMaxPhotos');
$tantan_fpbSize = get_option('tantan_fpbSize');
$tantan_fbpLinkDest = get_option('tantan_fbpLinkDest');
$tantan_fbpLinkDestValue = get_option('tantan_fbpLinkDestValue');
$tantan_fpbAutoLoadDisabled=get_option('tantan_fpbAutoLoadDisabled');
include(dirname(__FILE__).'/post-bar-admin.html');
}
// install hooks
add_action('edit_form_advanced', 'tantan_fpbFormDisplay');
add_action('simple_edit_form', 'tantan_fpbFormDisplay');
add_action('edit_page_form', 'tantan_fpbFormDisplay');
add_action('admin_menu', 'tantan_fpbAdminOptions');
?>
Toolkits
http://www.otheredge.com.au/klogs/toolkit
Mon, 07 Jan 2008 02:36:31 +0000http://wordpress.org/?v=2.0.1enCoffee - a photoset on Flickr
http://www.otheredge.com.au/klogs/toolkit/2006/coffee-a-photoset-on-flickr.htm
http://www.otheredge.com.au/klogs/toolkit/2006/coffee-a-photoset-on-flickr.htm#commentsThu, 17 Aug 2006 02:28:47 +0000KirstyCommunication & SupportInnovation, IdeasToolshttp://www.otheredge.com.au/klogs/toolkit/2006/coffee-a-photoset-on-flickr.htmhttp://www.otheredge.com.au/klogs/toolkit/2006/coffee-a-photoset-on-flickr.htm/feed/Students on blogging
http://www.otheredge.com.au/klogs/toolkit/2006/students-on-blogging.htm
http://www.otheredge.com.au/klogs/toolkit/2006/students-on-blogging.htm#commentsWed, 10 May 2006 23:31:43 +0000KirstyCommunication & SupportRSS & BloggingLearning Designhttp://www.otheredge.com.au/klogs/toolkit/2006/students-on-blogging.htmhttp://www.otheredge.com.au/klogs/toolkit/2006/students-on-blogging.htm/feed/SMS for student support
http://www.otheredge.com.au/klogs/toolkit/2004/sms-for-student-support.htm
http://www.otheredge.com.au/klogs/toolkit/2004/sms-for-student-support.htm#commentsSun, 12 Dec 2004 21:58:40 +0000KirstyCommunication & Supporthttp://www.otheredge.com.au/wordpress/?p=524http://www.otheredge.com.au/klogs/toolkit/2004/sms-for-student-support.htm/feed/Communication dynamics: Discussion boards, weblogs and the development of communities of inquiry in online learning environments
http://www.otheredge.com.au/klogs/toolkit/2004/communication-dynamics-discussion-boards-weblogs-and-the-development-of-communities-of-inquiry-in-online-learning-environments.htm
http://www.otheredge.com.au/klogs/toolkit/2004/communication-dynamics-discussion-boards-weblogs-and-the-development-of-communities-of-inquiry-in-online-learning-environments.htm#commentsTue, 12 Oct 2004 02:53:08 +0000KirstyCommunication & Supporthttp://www.otheredge.com.au/wordpress/?p=504http://www.otheredge.com.au/klogs/toolkit/2004/communication-dynamics-discussion-boards-weblogs-and-the-development-of-communities-of-inquiry-in-online-learning-environments.htm/feed/Research Insights into Interactivity
http://www.otheredge.com.au/klogs/toolkit/2004/research-insights-into-interactivity.htm
http://www.otheredge.com.au/klogs/toolkit/2004/research-insights-into-interactivity.htm#commentsWed, 23 Jun 2004 01:35:36 +0000KirstyCommunication & SupportLearning Designhttp://www.otheredge.com.au/wordpress/?p=471http://www.otheredge.com.au/klogs/toolkit/2004/research-insights-into-interactivity.htm/feed/Books
http://www.otheredge.com.au/klogs/toolkit/2004/books.htm
http://www.otheredge.com.au/klogs/toolkit/2004/books.htm#commentsWed, 02 Jun 2004 04:27:23 +0000KirstyCommunication & Supporthttp://www.otheredge.com.au/wordpress/?p=458http://www.otheredge.com.au/klogs/toolkit/2004/books.htm/feed/Exploring locality: The impact of context on Indigenous vocational education and training aspirations and outcomes
http://www.otheredge.com.au/klogs/toolkit/2004/exploring-locality-the-impact-of-context-on-indigenous-vocational-education-and-training-aspirations-and-outcomes.htm
http://www.otheredge.com.au/klogs/toolkit/2004/exploring-locality-the-impact-of-context-on-indigenous-vocational-education-and-training-aspirations-and-outcomes.htm#commentsFri, 23 Apr 2004 01:36:01 +0000KirstyCommunication & Supporthttp://www.otheredge.com.au/wordpress/?p=407http://www.otheredge.com.au/klogs/toolkit/2004/exploring-locality-the-impact-of-context-on-indigenous-vocational-education-and-training-aspirations-and-outcomes.htm/feed/The Value of Debriefing Learning Experiences
http://www.otheredge.com.au/klogs/toolkit/2004/the-value-of-debriefing-learning-experiences.htm
http://www.otheredge.com.au/klogs/toolkit/2004/the-value-of-debriefing-learning-experiences.htm#commentsThu, 11 Mar 2004 20:50:25 +0000KirstyCommunication & Supporthttp://www.otheredge.com.au/wordpress/?p=375http://www.otheredge.com.au/klogs/toolkit/2004/the-value-of-debriefing-learning-experiences.htm/feed/Groupboard Free Demo
http://www.otheredge.com.au/klogs/toolkit/2004/groupboard-free-demo.htm
http://www.otheredge.com.au/klogs/toolkit/2004/groupboard-free-demo.htm#commentsMon, 05 Jan 2004 21:09:22 +0000KirstyCommunication & Supporthttp://www.otheredge.com.au/wordpress/?p=343http://www.otheredge.com.au/klogs/toolkit/2004/groupboard-free-demo.htm/feed/Recommendations for teaching in a distributed learning environment: The students’ perspective
http://www.otheredge.com.au/klogs/toolkit/2003/recommendations-for-teaching-in-a-distributed-learning-environment-the-students-perspective.htm
http://www.otheredge.com.au/klogs/toolkit/2003/recommendations-for-teaching-in-a-distributed-learning-environment-the-students-perspective.htm#commentsFri, 12 Dec 2003 00:21:25 +0000KirstyCommunication & Supporthttp://www.otheredge.com.au/wordpress/?p=321http://www.otheredge.com.au/klogs/toolkit/2003/recommendations-for-teaching-in-a-distributed-learning-environment-the-students-perspective.htm/feed/