[oik] plugins.com

WordPress plugins and themes

  • Home
  • About
    • lazy shortcodes
    • smart shortcodes
    • oik base plugin
      • oik – donate
      • oik PayPal buttons
      • oik installation
      • oik Button Shortcode button
      • oik changelog
      • oik FAQ
      • oik plugins on SVN
      • oik plugins on GitHub
  • Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins
    • Bespoke oik plugins
  • Shortcodes
    • Shortcode examples
  • Blocks
    • Block examples
  • APIs
    • ALL action and filter hooks
  • Blog

bw_wtf() – Implement the [bw_wtf] shortcode

Description

Implement the [bw_wtf] shortcode

Return 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-syntax

Source

File name: oik/shortcodes/oik-wtf.php
Lines:
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
  • Tests_shortcodes_oik_wtf::test_bw_wtf() –
  • Tests_shortcodes_oik_wtf::test_bw_wtf_bb_BB() –

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

    Call hooks

    Function name: bw_wtf
    Plugin ref: oik – oik information kit
    Version: 4.15.3
    Sourcefile: shortcodes/oik-wtf.php
    File ref: shortcodes/oik-wtf.php
    API type: shortcode
    Deprecated?: No
    API Letters: B,W

    Published: February 2, 2018 | Last updated: February 2, 2018

    Information

    Function name: bw_wtf
    Plugin ref: oik – oik information kit
    Version: 4.15.3
    Sourcefile: shortcodes/oik-wtf.php
    File ref: shortcodes/oik-wtf.php
    API type: shortcode
    Deprecated?: No
    API Letters: B,W

    Recent plugin updates

    oik-weight-zone-shipping v0.2.13 oik-weight-zone-shipping v0.2.13 has been tested with WooCommerce 10.1.2 and WordPress 6.8.2 ...
    SB Children Block v1.3.0 Upgrade to SB Children Block v1.3.0 for support for PHP 8.3 and PHP 8.4  ...
    oik v4.15.3 Update to oik v4.15.3 for a couple of security fixes. Tested with WordPress 6.8.2 ...
    oik-privacy-policy v1.4.9 Update to oik-privacy-policy v1.4.9 for a security fix. Tested with WordPress 6.8.2 and PHP 8.3 and PHP 8.4 ...
    oik-nivo-slider v1.17.0 oik-nivo-slider v1.17.0 introduces the Nivo slider block - oik-nivo-slider/nivo. ...

    Plugins

    • All Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins

    Themes

    • FREE themes
    • Bespoke themes
    • Premium themes

    Blocks

    • All Blocks
    • Block examples
    • About Blocks

    Shortcodes

    • All Shortcodes
    • Shortcode examples
    • About Shortcodes

    Reference

    • About APIs
    • All APIs
    • All Classes
    • All Files
    • All Hooks

    Support

    • Contact
    • Cookies policy
    • Get API key
    • Privacy
    • Request support
    • Sitemap
    • Stay informed
    • Terms and Conditions
    oik-plugins
    Email: herb@bobbingwide.com

    Weight shipping plugins

    Find out which cart weight shipping plugin you need for your WooCommerce site.
    Which cart weight based plugin do I need?

    Site:  www.oik-plugins.com
    © Copyright oik-plugins 2011-2025. All rights reserved.


    Website designed and developed by Herb Miller of Bobbing Wide
    Proudly powered by WordPress and oik-plugins

    WordPress version: 6.8.3

    Gutenberg version: 21.7.0

    PHP version: 8.2.29