get_suffix(); $font_icon_names[] = $font_icon_field . et_pb_sticky_options()->get_suffix(); } $font_icon_option_names = implode( '|', $font_icon_names ); et_core_cache_set( $cache_key, $font_icon_option_names ); } else { $font_icon_option_names = et_core_cache_get( $cache_key ); } return $font_icon_option_names; } endif; if ( ! function_exists( 'et_pb_get_font_icon_names_regex' ) ) : /** * Returns the regex that will be used to check containing of the font icon option in the content. * * @since ? * * @param bool $maybe_fa_icon_type define what kind of font icon we need o get regex. * * @return string */ function et_pb_get_font_icon_names_regex( $maybe_fa_icon_type = false ) { $icon_type = $maybe_fa_icon_type ? 'fa' : 'divi'; return '/(' . et_pb_get_all_font_icon_option_names_string() . ')\=\"([^"]*)\|\|(' . $icon_type . ')\|\|(400|900)\"/mi'; } endif; if ( ! function_exists( 'et_pb_check_if_post_contains_fa_font_icon' ) ) : /** * Check if post content contains FontAwesome icon. * * @since ? * * @param string $content post's content. * * @return bool */ function et_pb_check_if_post_contains_fa_font_icon( $content ) { return ! empty( preg_match_all( et_pb_get_font_icon_names_regex( true ), $content ) ); } endif; if ( ! function_exists( 'et_pb_check_if_post_contains_divi_font_icon' ) ) : /** * Check if post content contains Divi icon. * * @since ? * * @param string $content post's content. * * @return bool */ function et_pb_check_if_post_contains_divi_font_icon( $content ) { // Check the non-extended icon value. $non_extended_icon_regex = '/(' . et_pb_get_all_font_icon_option_names_string() . ')\=\"%%([^"]*)%%\"/mi'; return ! empty( preg_match_all( et_pb_get_font_icon_names_regex(), $content ) ) || ! empty( preg_match_all( $non_extended_icon_regex, $content ) ); } endif; if ( ! function_exists( 'et_pb_check_if_post_contains_network_with_fa_icon' ) ) : /** * Check if post content contains a social network attribute with FA icon. * * @param string $content to search for attribute in. * * @since ? * * @return bool */ function et_pb_check_if_post_contains_network_with_fa_icon( $content ) { $regex = '/social_network\=\"(' . implode( '|', et_pb_get_social_net_fa_icons() ) . ')\"/mi'; return ! empty( preg_match_all( $regex, $content ) ); } endif; if ( ! function_exists( 'et_pb_get_font_icon_modules' ) ) : /** * Returns the list of Divi modules with `select_icon` option. * * @param string $group certain group of modules . * * @since ? * * @return array|null */ function et_pb_get_font_icon_modules( $group = false ) { $font_icon_modules_used_in_migrations = array( 'button' => array( 'et_pb_button', 'et_pb_comments', 'et_pb_contact_form', 'et_pb_cta', 'et_pb_fullwidth_header', 'et_pb_fullwidth_post_slider', 'et_pb_login', 'et_pb_post_slider', 'et_pb_pricing_tables', 'et_pb_pricing_table', 'et_pb_signup', 'et_pb_slider', 'et_pb_slide', 'et_pb_wc_add_to_cart', 'et_pb_wc_cart_notice', ), 'blurb' => array( 'et_pb_blurb', ), 'overlay' => array( 'et_pb_blog', 'et_pb_filterable_portfolio', 'et_pb_fullwidth_image', 'et_pb_fullwidth_portfolio', 'et_pb_gallery', 'et_pb_image', 'et_pb_portfolio', 'et_pb_shop', 'et_pb_wc_related_products', 'et_pb_wc_upsells', ), 'toggle' => array( 'et_pb_toggle', ), ); $other_select_icon_modules = array( 'select_icon' => array( 'et_pb_icon', 'et_pb_video', 'et_pb_video_slider', 'et_pb_video_slider_item', 'et_pb_testimonial', 'et_pb_accordion', 'et_pb_accordion_item', ), ); if ( false === $group ) { // Return all modules that use select_icon. $all_modules = array(); $all_select_icon_modules = array_merge( $font_icon_modules_used_in_migrations, $other_select_icon_modules ); foreach ( $all_select_icon_modules as $select_icon_module ) { $all_modules = array_merge( $all_modules, $select_icon_module ); } return $all_modules; } elseif ( isset( $font_icon_modules_used_in_migrations[ $group ] ) ) { // Return certain modules list by $group flag. return $font_icon_modules_used_in_migrations[ $group ]; } return null; } endif; if ( ! function_exists( 'et_pb_get_extended_font_icon_symbols' ) ) : /** * Returns full list of all icons used in the Divi with ['search_terms'], * unicode icon value ['unicode'], icon name ['name'] * groups in which the icon is included ['styles'], * bool flag which determined is this icon a divi icon or FontAwesome icon['is_divi_icon']. * * @since ? * * @return array */ function et_pb_get_extended_font_icon_symbols() { $full_icons_list_path = __DIR__ . '/full_icons_list.json'; if ( file_exists( $full_icons_list_path ) ) { $icons_data = json_decode( file_get_contents( $full_icons_list_path ), true ); if ( JSON_ERROR_NONE === json_last_error() ) { return $icons_data; } } et_wrong( 'Problem with loading the icon data on this path: ' . $full_icons_list_path ); } endif;