to select the next quote in line, if seconds have elapsed since the last such rotation. The "types" you can select in the config screen are: raw: show quote and author wrapped in a drtquotebox_raw div framed: show quote and author wrapped in a drtquotebox_frm div author: Inside a drtquotebox_sez div, show says: quote: Inside a drtquotebox_sig div, show -- code: Execute arbitrary php code (contained in quote field). The code must set $retval, which is displayed. Here is suggested .css code: .drtquotebox_raw { text-align:center; } .drtquotebox_frm { background-color:#fff2bf; font-size:small; border: 1px solid #000; padding: 0.7em; width:50%; height:auto; margin-left:25% } .drtquotebox_sez { background-color:#fff2bf; font-size:small; border: 1px solid #000; padding: 0.7em; width:50%; height:auto; margin-left:25% } .drtquotebox_sig { background-color:#fff2bf; font-size:small; border: 1px solid #000; padding: 0.7em; width:50%; height:auto; margin-left:25% } */ class drt_quoter { function get( $group, $interval = 1 ) { $retval = ""; $rotate = false; $stamps = get_settings( "drt_quoter_stamps" ); $opts = get_settings( "drt_quoter_opt" ); $phrases = array(); foreach( $opts as $opt ) { if( $opt["group"] == $group ) array_push( $phrases, $opt ); } if( !is_numeric( $interval ) ) { switch( $interval ) { case "random": $interval = 0; break; case "fixed": $interval = -1; break; case "rotate": default: $interval = 1; break; } } if( $interval >= 0 ) { $rotate = true; if( $interval > 1 && ( ( time() - $stamps[$group]["time"] ) <= $interval ) ) $rotate = false; } $cur_num = $stamps[$group]["num"]; $quote = stripslashes($phrases[$cur_num]["quote"]); $auth = stripslashes($phrases[$cur_num]["auth"]); switch( $phrases[$cur_num]["type"] ) { case "raw": $retval = "
$quote$auth
"; break; case "framed": $retval = "
$quote$auth
"; break; case "author": $retval = "
"; $retval.= "
$auth Says:
"; $retval.= "
$quote
"; $retval.= "
"; break; case "quote": $retval = "
"; $retval.= "
$quote
"; $retval.= "
-- $auth
"; $retval.= "
"; break; case "code": eval( $quote ); break; } if( $rotate ) { if( !$interval ) $cur_num = rand( 0, count( $phrases ) ); else { $cur_num++; if ($cur_num >= count( $phrases ) ) $cur_num = 0; } $stamps[$group]["num"] = $cur_num; $stamps[$group]["time"] = time(); update_option('drt_quoter_stamps', $stamps); } return( $retval ); } function show( $group, $interval = 1 ) { echo drt_quoter::get( $group, $interval ); } function getcats( $opts ) { $cats = array(); foreach( $opts as $opt ) $cats[ $opt[ "group" ] ]++; return( $cats ); } function options_page_contents() { global $user_level; $opts = get_settings( "drt_quoter_opt" ); $request = $_REQUEST[ "drtact" ]; $submitted = isset($_REQUEST['drt_quoter_submit']); /** Commit changed options if posted **/ if( ( $_REQUEST['drt_quoter_quote']['quote'] || $request == "delete" ) && ( $user_level > 5 ) && ( $submitted || $request != "" ) ) { if( $submitted ) { $ourid = $_REQUEST['drt_quoter_quote']['id']; $opts[$ourid] = $_REQUEST['drt_quoter_quote']; } else { $ourid = $_REQUEST['quote']; switch( $request ) { case "delete": array_splice( $opts, $ourid, 1 ); break; case "edit": if( isset( $_REQUEST['drt_quoter_quote'] ) ) $opts[$ourid] = $_REQUEST['drt_quoter_quote']; break; } } update_option('drt_quoter_opt', $opts); } echo "

DRT Quoter

"; if( is_array( $opts ) ) { $cats = drt_quoter::getcats( $opts ); echo ""; echo ''; ?> $optline ) { if( $wantedgroup == "#ALL#" || $wantedgroup == $optline["group"] ) { $class = ('alternate' == $class) ? '' : 'alternate'; ?>
5) echo "Edit"; ?> 5) echo "Delete"; ?>
No quotes yet.

"; $freeid = 0; while( isset( $opts[$freeid] ) ) $freeid++; if( $user_level > 5 && $_REQUEST[ 'drtact' ] == "edit" ) { $freeid = $_REQUEST['quote']; echo "

Edit Existing Quote:

"; echo ""; $optline["group"] = $opts[$freeid]['group']; $optline["type"] = $opts[$freeid]['type']; $optline["quote"] = $opts[$freeid]['quote']; $optline["auth"] = $opts[$freeid]['auth']; } else { echo "

Add New Quote

"; echo ""; $optline = array(); } ?>

Options saved

'; echo '
'; drt_quoter::options_page_contents(); echo '

'; echo '
'; } function admin_menu() { add_management_page('DRT Quoter', 'DRT Quoter', 5, basename(__FILE__), array('drt_quoter', 'options_page')); } } add_action('admin_menu', array('drt_quoter', 'admin_menu')); ?>