: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'install_error_content' => wp_kses(
sprintf( /* translators: %s - WPForms Support URL. */
__( 'There was an error installing the icon library. Please try again later or <a href="%s" target="_blank" rel="noreferrer noopener">contact support</a> if the issue persists.', 'wpforms-lite' ),
'https://wpforms.com/account/support/',
'Icon Library Install Failure'
'reinstall_prompt_content' => esc_html__( 'The icon library appears to be missing or damaged. It will now be reinstalled.', 'wpforms-lite' ),
'icon_picker_title' => esc_html__( 'Icon Picker', 'wpforms-lite' ),
'icon_picker_description' => esc_html__( 'Browse or search for the perfect icon.', 'wpforms-lite' ),
'icon_picker_search_placeholder' => esc_html__( 'Search 2000+ icons...', 'wpforms-lite' ),
'icon_picker_not_found' => esc_html__( 'Sorry, we didn\'t find any matching icons.', 'wpforms-lite' ),
if ( ! $this->is_installed() ) {
$strings['icon_choices']['is_installed'] = true;
$strings['icon_choices']['icons'] = $this->get_icons();
* Get an SVG icon code from a file for inline output in HTML.
* Note: the output does not need escaping.
* @param string $icon Font Awesome icon name.
* @param string $style Font Awesome style (solid, brands).
* @param int $size Icon display size.
private function get_icon( $icon, $style, $size ) {
$icon_sizes = $this->get_icon_sizes();
$filename = realpath( "{$this->cache_base_path}/svgs/{$style}/{$icon}.svg" );
if ( ! $filename || ! is_file( $filename ) || ! is_readable( $filename ) ) {
$svg = file_get_contents( $filename );
$height = ! empty( $icon_sizes[ $size ]['size'] ) ? $icon_sizes[ $size ]['size'] : $icon_sizes['large']['size'];
$width = $height * 1.25; // Icon width is equal or 25% larger/smaller than height. We force the largest value for all icons.
return str_replace( 'viewBox=', 'width="' . $width . '" height="' . $height . 'px" viewBox=', $svg );
* Get all available icons from the metadata file.
private function get_icons() {
if ( ! is_file( $this->icons_data_file ) || ! is_readable( $this->icons_data_file ) ) {
$icons = file_get_contents( $this->icons_data_file );
return (array) json_decode( $icons, false );
* Get default accent color.
public static function get_default_color() {
$render_engine = wpforms_get_render_engine();
return array_key_exists( $render_engine, self::DEFAULT_COLOR ) ? self::DEFAULT_COLOR[ $render_engine ] : self::DEFAULT_COLOR['modern'];