* @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() { global $zensor_update_message; $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_post_kses($_POST[$option]) ); } } $zensor_update_message = __("Options updated!", "zensor"); } 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); } $zensor_update_message = __('Default options reloaded.', 'zensor'); } } /** * 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 '

»"/> »"/>

" 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'), 2 ); } ?>