_bw_mailto_link() – Generate a mailto: link with optional subject= parameter

You appear to be a bot. Output may be restricted

Description

Generate a mailto: link with optional subject= parameter

Note: subject= parameter doesn't default to true since it makes it hard to turn it off. ie. subject=n doesn't work. Perhaps this could become a site wide option ?

Usage

$string = _bw_mailto_link( $email, $atts );

Parameters

$email
( string ) required – email address
$atts
( array ) required – shortcode parameters – possibly containing subject= parameter

Returns

string mailto: link with optional subject

Source

File name: oik/shortcodes/oik-email.php
Lines:

1 to 13 of 13
function _bw_mailto_link( $email, $atts ) {
  $emailasb = antispambot( $email, 1 ); 
  $email_link = "mailto:". $emailasb;
  $subject = bw_array_get( $atts, "subject", false );
  if ( $subject ) {
    if ( bw_validate_torf( $subject ) ) {
      $subject = get_the_title();
    }
    $subject = rawurlencode( $subject );
    $email_link .= "?Subject=$subject";
  }   
  return( $email_link );
} 
 

 View on Trac