Description
Implement the [bw_countdown] shortcode
Usage
$string = bw_countdown( $atts, $content, $tag );Parameters
- $atts
- ( array ) optional – shortcode parameters
- $content
- ( string ) optional – not expected
- $tag
- ( string ) optional – shortcode tag – not expected
Returns
string the required jQuery and HTMLSource
File name: oik/shortcodes/oik-countdown.phpLines:
1 to 31 of 31
function bw_countdown( $atts=null, $content=null, $tag=null ) { oik_require( "includes/bw_jquery.inc" ); $until = bw_array_get( $atts, "until", null ); if ( $until ) { $atts["until"] = bw_countdown_date( $until ); } else { $since = bw_array_get( $atts, "since", null ); if ( $since ) { $atts['since'] = bw_countdown_date( $since ); } else { $atts['until'] = bw_countdown_date( "+10" ); } } $class = bw_array_get( $atts, "class", null ); $id = bw_array_get( $atts, "id", null ); if ( null === $id ) { $id = bw_countdown_id(); } $debug = bw_array_get( $atts, "debug", false ); $script = bw_array_get( $atts, "script", "countdown" ); $style = bw_array_get( $atts, "style", $script ); $atts = bw_alter_atts( $atts, "class,id,debug,script,style", "expiryText,expiryUrl" ); $parms = bw_jkv( $atts ); $parms = bw_allow_js( $parms ); oik_require( "shortcodes/oik-jquery.php" ); bw_jquery_enqueue_script( $script, $debug ); bw_jquery_enqueue_style( $style ); bw_jquery( "div#$id" , "countdown", $parms, false ); sediv( $class, $id ); return( bw_ret() ); }View on GitHub View on Trac
Invoked by
Calls
1 to 11 of 11
- bw_allow_js() – Reset literal JavaScript code that is now enclosed in pairs of double and single quotes "’js code’" Also convert escaped slashes back to normal slashes
- bw_alter_atts() –
- bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set
- bw_countdown_date() – Return the required JavaScript date or, if it’s an adjustment, leave the adjustment as is
- bw_jkv() – Format an array of parms for jQuery
- bw_jquery() – Dynamic jQuery setting the selector, function and option parameters
- bw_jquery_enqueue_script() – Enqueue the jQuery script identifying dependencies
- bw_jquery_enqueue_style() – Enqueue style files required for this script
- bw_ret() – Use bw_ret() to return the contents of $bwecho, leaving the global value as NULL
- oik_require() – Invoke require_once on an oik include file or other file
- sediv() – Create a dummy div which may be used for placing graphics using background images in CSS
