diff --git a/functions.php b/functions.php index 27527d1..90dccbb 100644 --- a/functions.php +++ b/functions.php @@ -1,764 +1,961 @@ . + +/* + * Configuration helpers + * + * Shortcuts useful when you declare a configuration file. + */ + + +/** + * Define a constant if it does not exist + * + * @param string $name Constant name + * @param string $value Constant value + */ function define_default( $name, $value ) { defined( $name ) or define( $name, $value ); } -function selected( $helper = PHP_INT_MAX, $current = PHP_INT_MAX, $force = false ) { - return html_property_when_matching( 'selected', 'selected', $helper, $current, $force); -} -function checked( $helper = PHP_INT_MAX, $current = PHP_INT_MAX, $force = false ) { - return html_property_when_matching( 'checked', 'checked', $helper, $current, $force); -} +/* + * Template helpers + * + * Shortcuts useful when you build a page + */ -function disabled( $helper = PHP_INT_MAX, $current = PHP_INT_MAX, $force = false ) { - return html_property_when_matching( 'disabled', 'disabled', $helper, $current, $force ); -} +/** + * Print a ' checked="checked"' HTML attribute under some circumstances + * + * This is useful for the HTML tag. + * + * @param mixed $helper If this is the only arg, prints + * @param mixed $current If this matches $helper, print + * @param bool $force If this is true, print + */ function _checked( $helper = PHP_INT_MAX, $current = PHP_INT_MAX, $force = false ) { echo checked( $helper, $current, $force ); } +/** + * Print a ' selected="selected"' HTML attribute under some circumstances + * + * This is useful for the