Description
Implement [bw_qrcode] shortcode to display the QR code file with a link if requiredNotes: the attribute defaulting needs to be improved
Usage
bw_qrcode( $atts );Parameters
- $atts
- ( mixed ) required –
Returns
voidSource
File name: oik/shortcodes/oik-qrcode.phpLines:
1 to 25 of 25
function bw_qrcode( $atts ) { $link = bw_array_get( $atts, 'link', null ); $company = bw_get_option( "company" ); $text = bw_array_get( $atts, 'text', $company ); $width = bw_array_get( $atts, 'width', null ); $height = bw_array_get( $atts, 'height', null ); $upload_dir = wp_upload_dir(); $baseurl = $upload_dir['baseurl']; $logo_image = bw_get_option( "qrcode-image" ); $image_url = $baseurl . $logo_image; /* translators: %s: company name */ $image = retimage( NULL, $image_url, sprintf( __( 'QR code for %1$s', "oik" ), $text ) , $width, $height ); if ( $link ) { BW_::alink( NULL, $link, $image, $company ); } else { e( $image ); } return( bw_ret()); }View on GitHub View on Trac
Called by
1 to 2 of 2
Invoked by
Calls
1 to 5 of 5
- bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set
- bw_get_option() – Get the value of an option field
- bw_ret() – Use bw_ret() to return the contents of $bwecho, leaving the global value as NULL
- e() – Outputs some translated / non-translatable text
- retimage() – Return an image tag
