* @copyright Copyright 2007 Edward Dale * @license http://www.gnu.org/licenses/gpl.txt GPL 2.0 * @version $Id: options.php 23 2007-06-21 12:56:30Z scompt $ * @link http://www.scompt.com/projects/zensor * @since 0.5 */ /** * Common functions used all over the Zensor package */ require_once(dirname(__FILE__).'/common.php'); /** * Functionality for the options screen */ class Zensor_Options { /** * Updates the options in the database from the user's submission * * @static */ function handle_update_options() { $zensor_options = Zensor_Common::get_options(); if ( isset($_POST['zensor_update_options']) ) { check_admin_referer('zensor_update-options'); foreach( $zensor_options as $option ) { if( !empty( $_POST[$option] ) ) { update_option( $option, wp_filter_kses($_POST[$option]) ); } } } else if( isset($_POST['zensor_reset_options'])) { check_admin_referer('zensor_reset-options'); $zensor_options = Zensor_Common::get_default_options(); foreach( $zensor_options as $option=>$value ) { update_option( $option, $value); } } } /** * Generates a dropdown select box to select the frequency for the provided option. * * @param string $name The option name */ function frequency_dropdown($name) { $current_value = get_option($name); $freqs = array(__('Immediately','zensor')=>'immediately', __('Hourly','zensor')=>'hourly', __('Daily','zensor')=>'daily'); echo '\n"; } /** * Display the options page for the Zensor plugin * * Pulls all the options out of the database and shows them in the form. * Also shows a status message if the options were just updated. * * @static */ function admin_options_page() { $zensor_options = Zensor_Common::get_options(); $messages = array(); foreach( $zensor_options as $option ) { $messages[$option] = stripslashes(get_option($option)); } // TODO: it'd be nice if this message was sent from the handle_update_options // method instead of having another if here. if( isset($_POST['zensor_update_options']) ) { echo '

'; _e("Options updated!", "zensor"); echo '

'; } else if( isset($_POST['zensor_reset_options']) ) { echo '

'; _e('Default options reloaded.', 'zensor'); echo '

'; } ?>

:
:

%THE_LINK%
%MODERATOR_NAME%
%MESSAGE%
%PAGE/POST%
%TITLE%
%PERMALINK%
%AUTHOR_NAME%
%STATUS%

»"/> »"/>

" onclick="if ( confirm('') ) { return true;}return false;" />

" onclick="if ( confirm('') ) { return true;}return false;" />

\n"; } } /* * Hook into the init action to process POSTs */ if( function_exists('add_action') ) { add_action('init', array('Zensor_Options', 'handle_update_options') ); } ?>