';
_e( 'These options can be used to force a particular date/time or number to be displayed.', 'fortyforty_plugin' );
_e( 'If they are not valid, they will be blanked when the page is saved.', 'fortyforty_plugin' );
echo ' ';
_e( '(The "Number" setting overrides the "Date/Time" setting.)', 'fortyforty_plugin' );
echo '';
}
/**
* Display options for the YEAR setting.
*/
function fortyforty_option_year() {
fortyforty_option_dropdown( FortyForty::YEAR, FortyForty::GetOptionList( '/List/Year', 'year' ) );
}
/**
* Display options for the LANGUAGE setting.
*/
function fortyforty_option_language() {
fortyforty_option_dropdown( FortyForty::LANGUAGE, FortyForty::GetOptionList( '/List/Language', 'language' ) );
}
/**
* Display options for the SCRIPTURE_VERSION setting.
*/
function fortyforty_option_scripture_version() {
fortyforty_option_dropdown( FortyForty::SCRIPTURE_VERSION, FortyForty::GetOptionList( '/List/Version', 'version' ) );
}
/**
* Display options for the TYPE setting.
*/
function fortyforty_option_type() {
fortyforty_option_dropdown( FortyForty::TYPE, array(
array (
'id' => 'day',
'value' => 'Daily (40 Days)' ),
array(
'id' => 'hour',
'value' => 'Hourly (40 Hours)')
));
}
/**
* Display options for the OVERLAP setting.
*/
function fortyforty_option_overlap() {
fortyforty_option_input( FortyForty::OVERLAP, 2 );
}
/**
* Display options for the DEBUG_DATE setting.
*/
function fortyforty_option_debug_date() {
fortyforty_option_input(FortyForty::DEBUG_DATE, 20); ?> YYYY-MM-DDYYYY-MM-DD HH:MM:SS
"
value="" /> $overlap ) ) {
return "$overlap";
}
}
add_action( 'admin_notices', create_function( '', sprintf( 'echo \'
%s
\';',
__( 'WARNING: "Overlap" value must be between 0 and 60; value set to 30.', 'fortyforty_plugin' ))));
return '30';
}
/**
* Validate the debug date.
*
* @param string $inputDate The value input by the user.
* @param string $type The prayer guide type.
* @return string The debug date, properly formatted.
*/
function fortyforty_plugin_validate_debug_date( $inputDate, $type ) {
if ( empty( $inputDate ) )
return '';
try {
$date = new DateTime( $inputDate );
return ( 'hour' == $type )
? $date->format( 'Y-m-d H:00:00' )
: $date->format( 'Y-m-d' );
} catch (Exception $exception) {
// Invalid date; we'll catch that below.
}
add_action( 'admin_notices', create_function('', sprintf( 'echo \'
%s
\';',
__( 'WARNING: "Force Date or Date/Time" was not valid; value cleared.', 'fortyforty_plugin' ))));
return '';
}
/**
* Validate the debug number.
*
* @param string $inputNumber The value input by the user.
* @return string The number to set.
*/
function fortyforty_plugin_validate_debug_number( $inputNumber ) {
if ( is_numeric( $inputNumber ) ) {
$number = ( $inputNumber + 0) / 1;
if ( ( -1 < $number ) && ( 42 > $number ) ) {
return "$number";
}
}
add_action( 'admin_notices', create_function( '', sprintf( 'echo \'
%s
\';',
__( 'WARNING: "Force Day/Hour Number" must be between 0 and 41; value cleared.', 'fortyforty_plugin' ))));
return '';
}