Description
Implement the [bw_wtf] shortcodeReturn the raw content fully escaped but with unexpanded shortcodes of the current post The shortcode now supports different events to trigger the display of the "wtf" content with different effects to display it: slideToggle or Toggle Note: In certain situations this shortcode will not be able to determine the correct content. For example the shortcode is being expanded in 'content' being passed directly to do_shortcode(). In this case the content of the global $post variable will be displayed rather than the content passed to do_shortcode().
Usage
$string = bw_wtf( $atts, $content, $tag );Parameters
- $atts
- ( mixed ) optional – parameters to the shortcode
- $content
- ( string ) optional – alternative way of getting content
- $tag
- ( string ) optional –
Returns
string the "raw" content – that could be put through WP-syntaxSource
File name: oik/shortcodes/oik-wtf.phpLines:
1 to 31 of 31
function bw_wtf( $atts=null, $content=null, $tag=null ) { if ( $content ) { $escaped_content = esc_html( $content ); } else { global $post; bw_trace2( $post, "post" ); if ( $post ) { $escaped_content = esc_html( $post->post_content ); } else { $escaped_content = "[bw_wtf] - nothing to see"; } } $event = bw_array_get_from( $atts, "event,0", "hover" ); $effect = bw_array_get_from( $atts, "effect,1", "slideToggle" ); /* translators: %1 Event eg Hover, %2 Effect eg slideToggle */ $text = bw_array_get_from( $atts, "text,2", sprintf( __( '%1$s to %2$s source', "oik" ), $event, $effect ) ); oik_require( "includes/bw_jquery.inc" ); bw_jquery_af( "div.bw_wtf", $event , "p.bw_wtf", $effect ); sdiv( "bw_wtf" ); BW_::p( $text ); stag( 'p', "bw_wtf", null, 'lang="HTML" escaped="true" style="display:none;"' ); $escaped_content = str_replace(array( "[", "]" ), array( "[", "]" ), $escaped_content ); //$escaped_content = str_replace( "–", "--", $escaped_content ); $escaped_content = str_replace( "-", "-", $escaped_content ); $escaped_content = str_replace( "\n", "", $escaped_content ); $escaped_content = str_replace( "\r", "", $escaped_content ); e( $escaped_content ); etag( "p" ); ediv(); return( bw_ret() ); }View on GitHub View on Trac
Called by
1 to 2 of 2
Invoked by
Calls
1 to 11 of 11
- BW_::p() – Outputs a paragraph of translated text
- bw_array_get_from() – Return the value from a list of possible parameters
- bw_jquery_af() – Simple jQuery anonymous function
- bw_ret() – Use bw_ret() to return the contents of $bwecho, leaving the global value as NULL
- bw_trace2() – Trace $value to the trace log file if tracing is active
- e() – Outputs some translated / non-translatable text
- ediv() – End a div
- etag() – Output an end tag
- oik_require() – Invoke require_once on an oik include file or other file
- sdiv() – Start a div
- stag() – Output an HTML opening tag
