Requires WordPress 2.2 Author: Glenn Slaven Author URI: http://blog.slaven.net.au/ Copyright 2004 Glenn Slaven (email : gdalziel@gmail.com) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ include_once (ABSPATH . WPINC . "/rss-functions.php"); include_once ('plugin-base.php'); if (!class_exists('wp_votd') && class_exists('plugin_base')) { class wp_votd extends plugin_base { var $name = 'Verse of the Day'; var $filename = __FILE__; function wp_votd() { parent::plugin_base(); add_action('wp_votd_update_contents', array(&$this, 'update_contents')); add_action('widgets_init', array(&$this, 'widget_init')); } function _install() { wp_schedule_event(0, 'daily', 'wp_votd_update_contents' ); $this->set_options('RESET'); $this->update_contents(); } function _uninstall() { delete_option('wp_votd_options'); delete_option('wp_votd_cache'); remove_action('wp_votd_update_contents', 'wp_votd_update_contents'); wp_clear_scheduled_hook('wp_votd_update_contents'); } function widget_init() { if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') ) return; register_sidebar_widget(array('Verse of the Day', 'widgets'), array(&$this, 'show_widget')); register_widget_control(array('Verse of the Day', 'widgets'), array(&$this, 'widget_control'), 300, 80); } function show_widget($args) { extract($args); $options = get_option('wp_votd_options'); echo $before_widget; echo $before_title . $options['wp_votd_title'] . $after_title; echo get_option('wp_votd_cache'); echo $after_widget; } function widget_control() { $options = get_option('wp_votd_options'); if ( $_POST["votd-submit"] ) { $new_title = strip_tags(stripslashes($_POST["votd-title"])); if ( $options['wp_votd_title'] != $new_title ) { $this->set_options('UPDATE', false, false, false, false, false, $new_title); $options['wp_votd_title'] = $new_title; } } $title = attribute_escape($options['wp_votd_title']); ?>
'http://www.gnpcb.org/esv/share/rss2.0/daily/', 'wp_votd_version' => 'ESV', 'wp_votd_name' => 'English Standard Version', 'wp_votd_template' => '[TEXT] ([TITLE][VERSION])[ENCLOSURE]
', 'wp_votd_title' => 'Verse of the Day' ); if ('RESET' == $action) { update_option('wp_votd_options', $options); } elseif ('UPDATE' == $action) { $options = get_option('wp_votd_options'); if ($version) { $options['wp_votd_version'] = $version; } if ($url) { $options['wp_votd_url'] = $url; } if ($name) { $options['wp_votd_name'] = $name; } if ($template) { $options['wp_votd_template'] = stripslashes($template); } if ($title) { $options['wp_votd_title'] = strip_tags(stripslashes($title)); } if (is_array($options)) { update_option('wp_votd_options', $options); $this->update_contents(); return $this->get_feed(true); } else { return false; } } } function options_page() { //Set the default feeds $VOTD_DEFAULT_FEEDS = array( 'ESV' => array('url' => 'http://www.gnpcb.org/esv/share/rss2.0/daily/', 'name' => 'English Standard Version'), 'NIV' => array('url' => 'http://www.biblegateway.com/usage/votd/rss/votd.rdf?31', 'name' => 'New International Version'), 'KJV' => array('url' => 'http://www.biblegateway.com/usage/votd/rss/votd.rdf?9', 'name' => 'King James Version') ); $post_vars = ($_POST ? $_POST : get_option('wp_votd_options')); if (isset($_POST['wp_votd_update'])) { $this->set_options('UPDATE', (strlen($_POST['wp_votd_version']) ? $_POST['wp_votd_version'] : $_POST['wp_votd_other_version']), (strlen($_POST['wp_votd_version']) ? $VOTD_DEFAULT_FEEDS[$_POST['wp_votd_version']]['url'] : $_POST['wp_votd_other_url']), (strlen($_POST['wp_votd_version']) ? $VOTD_DEFAULT_FEEDS[$_POST['wp_votd_version']]['name'] : $_POST['wp_votd_other_name']), $_POST['wp_votd_timeout'], $_POST['wp_votd_template']); } elseif (FALSE === get_option('wp_votd_options') || '' === get_option('wp_votd_options')) { $this->set_options('RESET'); } $options = get_option('wp_votd_options'); $cache_contents = $this->get_feed(); ?>Did you find this plugin useful? Please consider donating to help me continue developing it and other plugins.