'; } function ba_get_svg_clock_icon() { return ' '; } function ba_get_img_masking_shapes($shape) { $masking_shapes = array( 'none' => '', 'shape_1' => '', 'shape_2' => '', 'shape_3' => '', ); return $masking_shapes[$shape]; } function ba_get_post_types() { $post_types = get_post_types( array( 'public' => true, ), 'objects' ); $options = array(); foreach ($post_types as $post_type) { $options[$post_type->name] = $post_type->label; } // Deprecated 'Media' post type. $key = array_search('Media', $options, true); if ('attachment' === $key) { unset($options[$key]); } return apply_filters('uael_loop_post_types', $options); } function ba_get_taxonomies() { $taxonomies = get_taxonomies(array('show_in_nav_menus' => true), 'objects'); $options = array('' => ''); foreach ($taxonomies as $taxonomy) { $options[$taxonomy->name] = $taxonomy->label; } return $options; } function ba_get_date_link($post_id = null) { if (empty($post_id)) { $post_id = get_the_ID(); } $year = get_the_date('Y', $post_id); $month = get_the_time('m', $post_id); $day = get_the_time('d', $post_id); $url = get_day_link($year, $month, $day); return $url; } function ba_get_excerpt($post_id = null, $length = null) { if (empty($length)) { $length = 35; } return wpautop(strip_shortcodes(truncate_post($length, false, '', true))); } function ba_prev_arrow_icon() { return ''; } function ba_next_arrow_icon() { return ''; } if (!function_exists('dt_if_not_migrated')) { function dt_if_not_migrated() { $not_migrated = get_option('ba_version'); if ($not_migrated) { return true; } return false; } } function dt_backend_helpers($helpers) { $helpers['ifMigrated'] = dt_if_not_migrated() ? 'false' : 'true'; return $helpers; } add_filter('et_fb_backend_helpers', 'dt_backend_helpers'); /** * Track which icon-font asset handles this request needs. * * @param string|null $add Handle to mark as needed (et_icons_fa|et_icons_all). * * @return string[] All handles marked needed so far. */ if (!function_exists('dtq_needed_icon_assets')) { function dtq_needed_icon_assets($add = null) { static $needed = array(); if (null !== $add) { $needed[$add] = true; } return array_keys($needed); } } if (!function_exists('dtq_global_assets_list')) { function dtq_global_assets_list($global_list) { $assets_prefix = et_get_dynamic_assets_path(); $map = array( 'et_icons_fa' => "{$assets_prefix}/css/icons_fa_all.css", 'et_icons_all' => "{$assets_prefix}/css/icons_all.css", ); $assets_list = array(); foreach (dtq_needed_icon_assets() as $handle) { if (isset($map[$handle])) { $assets_list[$handle] = array('css' => $map[$handle]); } } return array_merge($global_list, $assets_list); } } /** * Ensure the correct icon font is loaded for a rendered icon. * * FontAwesome icons need the FA font; every other (Divi) icon needs the full * Divi icon font (icons_all) — otherwise only the small base set renders and * extended glyphs (e.g. warning) fall back to a literal letter. * * @param string $icon_data Icon value (unicode, optionally "||type||weight"). */ if (!function_exists('dtq_inject_fa_icons')) { function dtq_inject_fa_icons($icon_data) { $is_fa = function_exists('et_pb_maybe_fa_font_icon') && et_pb_maybe_fa_font_icon($icon_data); dtq_needed_icon_assets($is_fa ? 'et_icons_fa' : 'et_icons_all'); add_filter('et_global_assets_list', 'dtq_global_assets_list'); add_filter('et_late_global_assets_list', 'dtq_global_assets_list'); } } /** * Ensure the COMPLETE Divi icon font is available on the front end. * * Divi's "Dynamic Icons" performance feature only ships the small subset of * glyphs it detects in the page content, and its detector does not see icons * stored in our D5 module attributes. So extended Divi icons (warning, star, * heart, …) have no glyph and fall back to a literal letter. When one of our * modules has rendered a Divi icon, register the full ETmodules @font-face so * every glyph resolves. The full font is a superset of the base one, so this * is safe for base glyphs too. */ if (!function_exists('dtq_print_full_icon_font')) { function dtq_print_full_icon_font() { if (! in_array('et_icons_all', dtq_needed_icon_assets(), true)) { return; } $font_url = get_template_directory_uri() . '/core/admin/fonts/modules/all/modules.woff'; printf( '', esc_url($font_url) ); } } add_action('wp_footer', 'dtq_print_full_icon_font', 99); /** * Normalize an icon unicode value for output. * * Divi 4 stored icons either as a unicode entity ("àXX;", optionally with * "||type||weight") or as the legacy index format "%%NN%%". When a layout using * the legacy format is migrated to Divi 5, that "%%NN%%" string can survive into * the D5 icon object's `unicode` field and would otherwise render as raw glyphs. * Resolve it the same way Divi 4 did, via et_pb_process_font_icon(). Values that * are already a unicode entity are returned unchanged. * * @param string $unicode Raw unicode value from the icon attribute. * * @return string Unicode entity safe to print inside the icon . */ if (!function_exists('dtq_resolve_icon_unicode')) { function dtq_resolve_icon_unicode($unicode) { $unicode = (string) $unicode; if (false !== strpos($unicode, '%%') && function_exists('et_pb_process_font_icon')) { // et_pb_process_font_icon() returns the entity with the ampersand already // escaped ("&#xe0XX;"); decode once so the raw entity ("àXX;") is // what lands inside the icon and the browser renders the glyph. return html_entity_decode(et_pb_process_font_icon($unicode)); } return $unicode; } }