/** * Sanitize gradient. * */ function of_sanitize_gradient($input, $option = array()) { if (!is_array($input)) { $input = array(); } $std0 = ''; $std1 = ''; if (!empty($option['std']) && is_array($option['std'])) { if (!empty($option['std'][0])) { $std0 = $option['std'][0]; } if (!empty($option['std'][1])) { $std1 = $option['std'][1]; } } if (!array_key_exists(0, $input)) { $input['0'] = $std0; } if (!array_key_exists(1, $input)) { $input['1'] = $std1; } return array(0 => of_sanitize_hex($input['0'], $std0), 1 => of_sanitize_hex($input['1'], $std1)); }
/** * Sanitize color. * */ function of_sanitize_color($input, $option = array()) { return of_sanitize_hex($input, isset($option['std']) ? $option['std'] : ''); }