Global Colors
global_colors[$gkey]) ? $gkey : 'primary';
}
foreach($pagelayer->global_colors as $cid => $color){
$active_class = '';
if($cid == $gkey){
$active_class = 'pagelayer-global-selected';
}
?>
default;
}
if ( false === strpos( $input, 'rgba' ) ) {
// If string doesn't start with 'rgba' then santize as hex color
$input = sanitize_hex_color( $input );
} else {
// Sanitize as RGBa color
$input = str_replace( ' ', '', $input );
sscanf( $input, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
$input = 'rgba(' . pagelayer_in_range( $red, 0, 255 ) . ',' . pagelayer_in_range( $green, 0, 255 ) . ',' . pagelayer_in_range( $blue, 0, 255 ) . ',' . pagelayer_in_range( $alpha, 0, 1 ) . ')';
}
return $input;
}
}
/**
* Only allow values between a certain minimum & maxmium range
*
* @param number Input to be sanitized
* @return number Sanitized input
*/
if ( ! function_exists( 'pagelayer_in_range' ) ) {
function pagelayer_in_range( $input, $min, $max ){
if ( $input < $min ) {
$input = $min;
}
if ( $input > $max ) {
$input = $max;
}
return $input;
}
}
// Create font options
function pagelayer_create_font_options( $args, $set ){
$options = '';
foreach( $args as $value => $label ){
$_value = $value;
if(is_numeric($value)){
$_value = $label;
}
// Single item
if(is_string($label)){
$options .= pagelayer_sel_option( $_value, $label, $set);
continue;
}
if( $value == 'default'){
$options .= pagelayer_sel_option( '', $value, $set);
continue;
}
$options .= '