wpcom_shortcodereverse_parseattr

Common element attributes parsing and sanitizing for src, width and height.

Description

(array) wpcom_shortcodereverse_parseattr( (array) $attrs ); 

Returns (array)

$attrs With sanitized values.

Parameters (1)

0. $attrs (array)
With original values.

Usage

  1. if ( !function_exists( 'wpcom_shortcodereverse_parseattr' ) ) { 
  2. require_once '/modules/shortcodes.php'; 
  3.  
  4. // With original values. 
  5. $attrs = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpcom_shortcodereverse_parseattr($attrs); 
  9.  

Defined (1)

The function is defined in the following location(s).

/modules/shortcodes.php  
  1. function wpcom_shortcodereverse_parseattr( $attrs ) { 
  2. $defaults = array( 
  3. 'src' => false,  
  4. 'width' => false,  
  5. 'height' => false,  
  6. ); 
  7.  
  8. $attrs = shortcode_atts( $defaults, $attrs ); 
  9.  
  10. $attrs['src'] = strip_tags( $attrs['src'] ); // For sanity 
  11. $attrs['width'] = ( is_numeric( $attrs['width'] ) ) ? abs( intval( $attrs['width'] ) ) : $defaults['width']; 
  12. $attrs['height'] = ( is_numeric( $attrs['height'] ) ) ? abs( intval( $attrs['height'] ) ) : $defaults['height']; 
  13.  
  14. return $attrs;