Description
Apply a mapping to the width to adjust for different devicesNote: Added test on $i vs count( $map ) to fix infinite loop when $width exceeded the largest figure in the mapping.
Usage
$integer = oik_rwd_apply_width_mapping( $width, $map );Parameters
- $width
- ( integer ) required – original width
- $map
- ( mixed ) required –
Returns
integer new widthSource
File name: oik-rwd/shortcodes/oik-rwd.phpLines:
1 to 16 of 16
function oik_rwd_apply_width_mapping( $width, $map ) { $map = bw_as_array( $map ); $i = 0; $new_width = null; while ( $new_width === null && $i < count( $map ) ) { if ( $width <= $map[$i] ) { $new_width = $map[$i+1]; } $i++; $i++; } if ( $new_width === null ) { $new_width = $width; } return( $new_width ); }View on GitHub
Called by
1 to 1 of 1
Invoked by
Call hooks
API Letters:
