1 ) { $opacity = $opacity / 100; } $output = 'rgba(' . implode( ',', $rgb ) . ',' . $opacity . ')'; } else { $output = 'rgb(' . implode( ',', $rgb ) . ')'; } if ( $is_array ) { return $rgb; } else { return $output; } } /** * Initializes an array to replace recursive function * * @param var $settings returns the bas values. * * @param array $name returns the replacements values. * @param array $opc returns the replacements values. */ public static function cartflows_bb_colorpicker( $settings, $name = '', $opc = false ) { $hex_color = ''; $opacity = ''; $hex_color = $settings->$name; if ( '' != $hex_color && 'r' != $hex_color[0] && 'R' != $hex_color[0] ) { if ( true == $opc && isset( $settings->{ $name . '_opc' } ) ) { if ( '' !== $settings->{ $name . '_opc' } ) { $opacity = $settings->{ $name . '_opc' }; $rgba = self::cartflows_bb_hex2rgba( $hex_color, $opacity / 100 ); return $rgba; } } if ( '#' != $hex_color[0] ) { return '#' . $hex_color; } } return $hex_color; } /** * Provide option to parse a color code. * * @param var $code Returns a hex value for color from rgba or #hex color. * @return string - hex value for the color */ public static function cartflows_bb_parse_color_to_hex( $code = '' ) { $color = ''; $hex = ''; if ( '' != $code ) { if ( false !== strpos( $code, 'rgba' ) ) { $code = ltrim( $code, 'rgba(' ); $code = rtrim( $code, ')' ); $rgb = explode( ',', $code ); $hex .= str_pad( dechex( $rgb[0] ), 2, '0', STR_PAD_LEFT ); $hex .= str_pad( dechex( $rgb[1] ), 2, '0', STR_PAD_LEFT ); $hex .= str_pad( dechex( $rgb[2] ), 2, '0', STR_PAD_LEFT ); $color = $hex; } else { $color = ltrim( $code, '#' ); } } return $color; } /** * Check for the Beaver Builder's setting page. * * @since 1.6.x * @var function wcf_is_bb_setting_page */ public static function wcf_is_bb_setting_page() { if ( is_admin() && isset( $_GET['page'] ) && 'fl-builder-settings' === sanitize_text_field( $_GET['page'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended return true; } return false; } } }