function hoot_sanitize_font_size($value, $recognized = array()) { $recognized = is_array($recognized) && !empty($recognized) ? $recognized : hoot_enum_font_sizes(); $value_check = preg_replace('/px/', '', $value); if (in_array((int) $value_check, $recognized)) { return $value; } //return apply_filters( 'hoot_sanitize_default_font_size', $recognized ); // bug:returns an array. Example case: default is set to 15px, and custom typography only has 6 to 13px. On save, an array ($recognized) gets stores instead of string. return apply_filters('hoot_sanitize_default_font_size', '', $recognized); }
function hoot_enum_font_sizes_array($min = 9, $max = 82, $postfix = 'px') { $sizes = hoot_enum_font_sizes($min, $max); $output = array(); foreach ($sizes as $size) { $output[$size] = $size . $postfix; } return $output; }