Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder
File: functions.php
[2500] Fix | Delete
if ( empty( $cats_array ) ) {
[2501] Fix | Delete
$taxonomy_type = $args['use_terms'] ? $args['term_name'] : 'category';
[2502] Fix | Delete
$taxonomy = get_taxonomy( $taxonomy_type );
[2503] Fix | Delete
$labels = get_taxonomy_labels( $taxonomy );
[2504] Fix | Delete
$output = sprintf( '<p>%1$s</p>', esc_html( $labels->not_found ) );
[2505] Fix | Delete
}
[2506] Fix | Delete
[2507] Fix | Delete
foreach ( $cats_array as $category ) {
[2508] Fix | Delete
$contains = sprintf(
[2509] Fix | Delete
"<%%= _.contains( {$args['field_name']}_temp, '%1\$s' ) ? checked='checked' : '' %%>",
[2510] Fix | Delete
is_array( $category ) ? esc_html( $category['term_id'] ) : esc_html( $category->term_id )
[2511] Fix | Delete
);
[2512] Fix | Delete
[2513] Fix | Delete
$output .= sprintf(
[2514] Fix | Delete
'%4$s<label><input type="checkbox" name="%5$s" value="%1$s"%3$s> %2$s</label><br/>',
[2515] Fix | Delete
is_array( $category ) ? esc_html( $category['term_id'] ) : esc_html( $category->term_id ),
[2516] Fix | Delete
is_array( $category ) ? esc_html( $category['name'] ) : esc_html( $category->name ),
[2517] Fix | Delete
$contains,
[2518] Fix | Delete
"\n\t\t\t\t\t",
[2519] Fix | Delete
$args['field_name']
[2520] Fix | Delete
);
[2521] Fix | Delete
}
[2522] Fix | Delete
[2523] Fix | Delete
$output = "<div id='{$args['field_name']}'>" . $output . '</div>';
[2524] Fix | Delete
[2525] Fix | Delete
return apply_filters( 'et_builder_include_categories_option_html', $output );
[2526] Fix | Delete
}
[2527] Fix | Delete
endif;
[2528] Fix | Delete
[2529] Fix | Delete
if ( ! function_exists( 'et_builder_include_categories_shop_option' ) ) :
[2530] Fix | Delete
/**
[2531] Fix | Delete
* Generate output string for `include_shop_categories` option used in backbone template.
[2532] Fix | Delete
*
[2533] Fix | Delete
* @param array $args arguments to get shop categories.
[2534] Fix | Delete
* @return string
[2535] Fix | Delete
*/
[2536] Fix | Delete
function et_builder_include_categories_shop_option( $args = array() ) {
[2537] Fix | Delete
if ( ! class_exists( 'WooCommerce' ) ) {
[2538] Fix | Delete
return '';
[2539] Fix | Delete
}
[2540] Fix | Delete
[2541] Fix | Delete
$output = "\t<% var et_pb_include_categories_shop_temp = typeof data !== 'undefined' && typeof data.et_pb_include_categories !== 'undefined' ? data.et_pb_include_categories.split( ',' ) : []; et_pb_include_categories_shop_temp = typeof data === 'undefined' && typeof et_pb_include_categories !== 'undefined' ? et_pb_include_categories.split( ',' ) : et_pb_include_categories_shop_temp; %>\n";
[2542] Fix | Delete
[2543] Fix | Delete
$product_categories = et_builder_get_shop_categories( $args );
[2544] Fix | Delete
[2545] Fix | Delete
$output .= '<div id="et_pb_include_categories">';
[2546] Fix | Delete
[2547] Fix | Delete
if ( is_array( $product_categories ) && ! empty( $product_categories ) ) {
[2548] Fix | Delete
foreach ( $product_categories as $category ) {
[2549] Fix | Delete
if ( is_object( $category ) && is_a( $category, 'WP_Term' ) ) {
[2550] Fix | Delete
$contains = sprintf(
[2551] Fix | Delete
'<%%= _.contains( et_pb_include_categories_shop_temp, "%1$s" ) ? checked="checked" : "" %%>',
[2552] Fix | Delete
esc_html( $category->term_id )
[2553] Fix | Delete
);
[2554] Fix | Delete
[2555] Fix | Delete
$output .= sprintf(
[2556] Fix | Delete
'%4$s<label><input type="checkbox" name="et_pb_include_categories" value="%1$s"%3$s> %2$s</label><br/>',
[2557] Fix | Delete
esc_attr( $category->term_id ),
[2558] Fix | Delete
esc_html( $category->name ),
[2559] Fix | Delete
$contains,
[2560] Fix | Delete
"\n\t\t\t\t\t"
[2561] Fix | Delete
);
[2562] Fix | Delete
}
[2563] Fix | Delete
}
[2564] Fix | Delete
}
[2565] Fix | Delete
[2566] Fix | Delete
$output .= '</div>';
[2567] Fix | Delete
[2568] Fix | Delete
return apply_filters( 'et_builder_include_categories_option_html', $output );
[2569] Fix | Delete
}
[2570] Fix | Delete
endif;
[2571] Fix | Delete
[2572] Fix | Delete
if ( ! function_exists( 'et_divi_get_projects' ) ) :
[2573] Fix | Delete
/**
[2574] Fix | Delete
* Return projects.
[2575] Fix | Delete
*
[2576] Fix | Delete
* @param array $args WP_Query arguments.
[2577] Fix | Delete
*/
[2578] Fix | Delete
function et_divi_get_projects( $args = array() ) {
[2579] Fix | Delete
$default_args = array(
[2580] Fix | Delete
'post_type' => 'project',
[2581] Fix | Delete
);
[2582] Fix | Delete
$args = wp_parse_args( $args, $default_args );
[2583] Fix | Delete
return new WP_Query( $args );
[2584] Fix | Delete
}
[2585] Fix | Delete
endif;
[2586] Fix | Delete
[2587] Fix | Delete
if ( ! function_exists( 'et_pb_extract_items' ) ) :
[2588] Fix | Delete
/**
[2589] Fix | Delete
* Return pricing table items html.
[2590] Fix | Delete
*
[2591] Fix | Delete
* @param string $content Content.
[2592] Fix | Delete
*/
[2593] Fix | Delete
function et_pb_extract_items( $content ) {
[2594] Fix | Delete
$output = '';
[2595] Fix | Delete
$first_character = '';
[2596] Fix | Delete
[2597] Fix | Delete
$lines = array_filter( explode( "\n", str_replace( array( '<p>', '</p>', '<br />' ), "\n", $content ) ) );
[2598] Fix | Delete
foreach ( $lines as $line ) {
[2599] Fix | Delete
$line = trim( $line );
[2600] Fix | Delete
if ( '&#8211;' === substr( $line, 0, 7 ) ) {
[2601] Fix | Delete
$line = '-' . substr( $line, 7 );
[2602] Fix | Delete
}
[2603] Fix | Delete
if ( '' === $line ) {
[2604] Fix | Delete
continue;
[2605] Fix | Delete
}
[2606] Fix | Delete
$first_character = $line[0];
[2607] Fix | Delete
if ( in_array( $first_character, array( '-', '+' ), true ) ) {
[2608] Fix | Delete
$line = trim( substr( $line, 1 ) );
[2609] Fix | Delete
}
[2610] Fix | Delete
$output .= sprintf(
[2611] Fix | Delete
'[et_pb_pricing_item available="%2$s"]%1$s[/et_pb_pricing_item]',
[2612] Fix | Delete
$line,
[2613] Fix | Delete
( '-' === $first_character ? 'off' : 'on' )
[2614] Fix | Delete
);
[2615] Fix | Delete
}
[2616] Fix | Delete
return do_shortcode( $output );
[2617] Fix | Delete
}
[2618] Fix | Delete
endif;
[2619] Fix | Delete
[2620] Fix | Delete
/**
[2621] Fix | Delete
* Get all acceptable string value for given CSS property
[2622] Fix | Delete
*
[2623] Fix | Delete
* @param string $property property name.
[2624] Fix | Delete
* @return array of acceptable CSS string values of given property name.
[2625] Fix | Delete
*/
[2626] Fix | Delete
function et_builder_get_acceptable_css_string_values( $property = 'all' ) {
[2627] Fix | Delete
$css_string_values = array(
[2628] Fix | Delete
'width' => array(
[2629] Fix | Delete
'auto',
[2630] Fix | Delete
'inherit',
[2631] Fix | Delete
'initial',
[2632] Fix | Delete
'unset',
[2633] Fix | Delete
),
[2634] Fix | Delete
'max-width' => array(
[2635] Fix | Delete
'none',
[2636] Fix | Delete
'inherit',
[2637] Fix | Delete
'initial',
[2638] Fix | Delete
'unset',
[2639] Fix | Delete
),
[2640] Fix | Delete
'margin' => array(
[2641] Fix | Delete
'auto',
[2642] Fix | Delete
'inherit',
[2643] Fix | Delete
'initial',
[2644] Fix | Delete
'unset',
[2645] Fix | Delete
),
[2646] Fix | Delete
'padding' => array(
[2647] Fix | Delete
'inherit',
[2648] Fix | Delete
'initial',
[2649] Fix | Delete
'unset',
[2650] Fix | Delete
),
[2651] Fix | Delete
'height' => array(
[2652] Fix | Delete
'auto',
[2653] Fix | Delete
'inherit',
[2654] Fix | Delete
'initial',
[2655] Fix | Delete
'unset',
[2656] Fix | Delete
),
[2657] Fix | Delete
'min-height' => array(
[2658] Fix | Delete
'auto',
[2659] Fix | Delete
'inherit',
[2660] Fix | Delete
'initial',
[2661] Fix | Delete
'unset',
[2662] Fix | Delete
),
[2663] Fix | Delete
'max-height' => array(
[2664] Fix | Delete
'none',
[2665] Fix | Delete
'inherit',
[2666] Fix | Delete
'initial',
[2667] Fix | Delete
'unset',
[2668] Fix | Delete
),
[2669] Fix | Delete
'z-index' => array(
[2670] Fix | Delete
'auto',
[2671] Fix | Delete
),
[2672] Fix | Delete
'font-size' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
[2673] Fix | Delete
);
[2674] Fix | Delete
[2675] Fix | Delete
$acceptable_strings = apply_filters( 'et_builder_acceptable_css_string_values', $css_string_values );
[2676] Fix | Delete
[2677] Fix | Delete
if ( 'all' === $property ) {
[2678] Fix | Delete
return $acceptable_strings;
[2679] Fix | Delete
}
[2680] Fix | Delete
[2681] Fix | Delete
return isset( $acceptable_strings[ $property ] ) ? $acceptable_strings[ $property ] : array();
[2682] Fix | Delete
}
[2683] Fix | Delete
[2684] Fix | Delete
if ( ! function_exists( 'et_builder_process_range_value' ) ) :
[2685] Fix | Delete
/**
[2686] Fix | Delete
* Process range setting field value.
[2687] Fix | Delete
*
[2688] Fix | Delete
* @param string $range Range value.
[2689] Fix | Delete
* @param string $option_type CSS property.
[2690] Fix | Delete
*/
[2691] Fix | Delete
function et_builder_process_range_value( $range, $option_type = '' ) {
[2692] Fix | Delete
$range = trim( $range );
[2693] Fix | Delete
$range_digit = '';
[2694] Fix | Delete
[2695] Fix | Delete
if ( 'none' !== $range ) {
[2696] Fix | Delete
$range_digit = floatval( $range );
[2697] Fix | Delete
}
[2698] Fix | Delete
[2699] Fix | Delete
$range_string = str_replace( et_()->to_css_decimal( $range_digit ), '', (string) $range );
[2700] Fix | Delete
[2701] Fix | Delete
if ( '' !== $option_type && in_array( $range, et_builder_get_acceptable_css_string_values( $option_type ), true ) ) {
[2702] Fix | Delete
$result = $range;
[2703] Fix | Delete
} else {
[2704] Fix | Delete
if ( '' === $range_string ) {
[2705] Fix | Delete
$range_string = 'line_height' === $option_type && 3 >= $range_digit ? 'em' : 'px';
[2706] Fix | Delete
}
[2707] Fix | Delete
[2708] Fix | Delete
$result = et_()->to_css_decimal( $range_digit ) . $range_string;
[2709] Fix | Delete
}
[2710] Fix | Delete
[2711] Fix | Delete
return apply_filters( 'et_builder_processed_range_value', $result, $range, $range_string );
[2712] Fix | Delete
}
[2713] Fix | Delete
endif;
[2714] Fix | Delete
[2715] Fix | Delete
if ( ! function_exists( 'et_builder_get_border_styles' ) ) :
[2716] Fix | Delete
/**
[2717] Fix | Delete
* Return border styles options list.
[2718] Fix | Delete
*/
[2719] Fix | Delete
function et_builder_get_border_styles() {
[2720] Fix | Delete
$styles = array(
[2721] Fix | Delete
'solid' => esc_html__( 'Solid', 'et_builder' ),
[2722] Fix | Delete
'dashed' => esc_html__( 'Dashed', 'et_builder' ),
[2723] Fix | Delete
'dotted' => esc_html__( 'Dotted', 'et_builder' ),
[2724] Fix | Delete
'double' => esc_html__( 'Double', 'et_builder' ),
[2725] Fix | Delete
'groove' => esc_html__( 'Groove', 'et_builder' ),
[2726] Fix | Delete
'ridge' => esc_html__( 'Ridge', 'et_builder' ),
[2727] Fix | Delete
'inset' => esc_html__( 'Inset', 'et_builder' ),
[2728] Fix | Delete
'outset' => esc_html__( 'Outset', 'et_builder' ),
[2729] Fix | Delete
'none' => et_builder_i18n( 'None' ),
[2730] Fix | Delete
);
[2731] Fix | Delete
[2732] Fix | Delete
return apply_filters( 'et_builder_border_styles', $styles );
[2733] Fix | Delete
}
[2734] Fix | Delete
endif;
[2735] Fix | Delete
[2736] Fix | Delete
if ( ! function_exists( 'et_builder_font_options' ) ) :
[2737] Fix | Delete
/**
[2738] Fix | Delete
* Return an array of font options.
[2739] Fix | Delete
*/
[2740] Fix | Delete
function et_builder_font_options() {
[2741] Fix | Delete
$options = array();
[2742] Fix | Delete
[2743] Fix | Delete
$default_options = array(
[2744] Fix | Delete
'default' => array(
[2745] Fix | Delete
'name' => et_builder_i18n( 'Default' ),
[2746] Fix | Delete
),
[2747] Fix | Delete
);
[2748] Fix | Delete
$fonts = array_merge( $default_options, et_builder_get_fonts() );
[2749] Fix | Delete
[2750] Fix | Delete
foreach ( $fonts as $font_name => $font_settings ) {
[2751] Fix | Delete
$options[ $font_name ] = 'default' !== $font_name ? $font_name : $font_settings['name'];
[2752] Fix | Delete
}
[2753] Fix | Delete
[2754] Fix | Delete
return $options;
[2755] Fix | Delete
}
[2756] Fix | Delete
endif;
[2757] Fix | Delete
[2758] Fix | Delete
if ( ! function_exists( 'et_builder_get_google_font_items' ) ) :
[2759] Fix | Delete
/**
[2760] Fix | Delete
* Return google font list items.
[2761] Fix | Delete
*/
[2762] Fix | Delete
function et_builder_get_google_font_items() {
[2763] Fix | Delete
$output = '';
[2764] Fix | Delete
$font_options = et_builder_font_options();
[2765] Fix | Delete
[2766] Fix | Delete
foreach ( $font_options as $key => $value ) {
[2767] Fix | Delete
$output .= sprintf(
[2768] Fix | Delete
'<li class="select-option-item select-option-item-%3$s" data-value="%1$s">%2$s</li>',
[2769] Fix | Delete
esc_attr( $key ),
[2770] Fix | Delete
esc_html( $value ),
[2771] Fix | Delete
str_replace( ' ', '_', esc_attr( $key ) )
[2772] Fix | Delete
);
[2773] Fix | Delete
}
[2774] Fix | Delete
[2775] Fix | Delete
return $output;
[2776] Fix | Delete
}
[2777] Fix | Delete
endif;
[2778] Fix | Delete
[2779] Fix | Delete
if ( ! function_exists( 'et_builder_set_element_font' ) ) :
[2780] Fix | Delete
/**
[2781] Fix | Delete
* Return element font style.
[2782] Fix | Delete
*
[2783] Fix | Delete
* @param string $font Font style value.
[2784] Fix | Delete
* @param bool $use_important Whether use !important.
[2785] Fix | Delete
* @param bool $default Default font style value. e.x global font value.
[2786] Fix | Delete
*/
[2787] Fix | Delete
function et_builder_set_element_font( $font, $use_important = false, $default = false ) {
[2788] Fix | Delete
static $cache = array();
[2789] Fix | Delete
[2790] Fix | Delete
$style = '';
[2791] Fix | Delete
[2792] Fix | Delete
if ( '' === $font ) {
[2793] Fix | Delete
return $style;
[2794] Fix | Delete
}
[2795] Fix | Delete
[2796] Fix | Delete
$font_values = explode( '|', $font );
[2797] Fix | Delete
$default = ! $default ? '||||||||' : $default;
[2798] Fix | Delete
$font_values_default = explode( '|', $default );
[2799] Fix | Delete
[2800] Fix | Delete
if ( ! empty( $font_values ) ) {
[2801] Fix | Delete
// backward compatibility with old version of theme.
[2802] Fix | Delete
if ( isset( $font_values[1] ) ) {
[2803] Fix | Delete
$font_values[1] = 'on' === $font_values[1] ? '700' : $font_values[1];
[2804] Fix | Delete
}
[2805] Fix | Delete
[2806] Fix | Delete
$font_values = array_map( 'trim', $font_values );
[2807] Fix | Delete
$font_name = $font_values[0];
[2808] Fix | Delete
$font_weight = isset( $font_values[1] ) && '' !== $font_values[1] ? $font_values[1] : '';
[2809] Fix | Delete
$is_font_italic = isset( $font_values[2] ) && 'on' === $font_values[2] ? true : false;
[2810] Fix | Delete
$is_font_uppercase = isset( $font_values[3] ) && 'on' === $font_values[3] ? true : false;
[2811] Fix | Delete
$is_font_underline = isset( $font_values[4] ) && 'on' === $font_values[4] ? true : false;
[2812] Fix | Delete
$is_font_small_caps = isset( $font_values[5] ) && 'on' === $font_values[5] ? true : false;
[2813] Fix | Delete
$is_font_line_through = isset( $font_values[6] ) && 'on' === $font_values[6] ? true : false;
[2814] Fix | Delete
$font_line_color = isset( $font_values[7] ) ? $font_values[7] : '';
[2815] Fix | Delete
$font_line_style = isset( $font_values[8] ) ? $font_values[8] : '';
[2816] Fix | Delete
[2817] Fix | Delete
$font_name_default = $font_values_default[0];
[2818] Fix | Delete
$font_weight_default = isset( $font_values_default[1] ) && '' !== $font_values_default[1] ? $font_values_default[1] : '';
[2819] Fix | Delete
$is_font_italic_default = isset( $font_values_default[2] ) && 'on' === $font_values_default[2] ? true : false;
[2820] Fix | Delete
$is_font_uppercase_default = isset( $font_values_default[3] ) && 'on' === $font_values_default[3] ? true : false;
[2821] Fix | Delete
$is_font_underline_default = isset( $font_values_default[4] ) && 'on' === $font_values_default[4] ? true : false;
[2822] Fix | Delete
$is_font_small_caps_default = isset( $font_values_default[5] ) && 'on' === $font_values_default[5] ? true : false;
[2823] Fix | Delete
$is_font_line_through_default = isset( $font_values_default[6] ) && 'on' === $font_values_default[6] ? true : false;
[2824] Fix | Delete
$font_line_color_default = isset( $font_values_default[7] ) ? $font_values_default[7] : '';
[2825] Fix | Delete
$font_line_style_default = isset( $font_values_default[8] ) ? $font_values_default[8] : '';
[2826] Fix | Delete
[2827] Fix | Delete
if ( '' !== $font_name && $font_name_default !== $font_name && 'Default' !== $font_name ) {
[2828] Fix | Delete
if ( empty( $cache[ $font_name ] ) ) {
[2829] Fix | Delete
et_builder_enqueue_font( $font_name );
[2830] Fix | Delete
$font_family = et_builder_get_font_family( $font_name );
[2831] Fix | Delete
$cache[ $font_name ] = $font_family;
[2832] Fix | Delete
} else {
[2833] Fix | Delete
$font_family = $cache[ $font_name ];
[2834] Fix | Delete
}
[2835] Fix | Delete
[2836] Fix | Delete
if ( $use_important ) {
[2837] Fix | Delete
$font_family = rtrim( $font_family, ';' ) . ' !important;';
[2838] Fix | Delete
}
[2839] Fix | Delete
[2840] Fix | Delete
$style .= "$font_family ";
[2841] Fix | Delete
}
[2842] Fix | Delete
[2843] Fix | Delete
$style .= et_builder_set_element_font_style( 'font-weight', ( '' !== $font_weight_default && ( '' === $font_weight || $font_weight_default === $font_weight ) ), ( '' !== $font_weight ), 'normal', $font_weight, $use_important );
[2844] Fix | Delete
[2845] Fix | Delete
$style .= et_builder_set_element_font_style( 'font-style', $is_font_italic_default, $is_font_italic, 'normal', 'italic', $use_important );
[2846] Fix | Delete
[2847] Fix | Delete
$style .= et_builder_set_element_font_style( 'text-transform', $is_font_uppercase_default, $is_font_uppercase, 'none', 'uppercase', $use_important );
[2848] Fix | Delete
[2849] Fix | Delete
$style .= et_builder_set_element_font_style( 'text-decoration', $is_font_underline_default, $is_font_underline, 'none', 'underline', $use_important );
[2850] Fix | Delete
[2851] Fix | Delete
$style .= et_builder_set_element_font_style( 'font-variant', $is_font_small_caps_default, $is_font_small_caps, 'none', 'small-caps', $use_important );
[2852] Fix | Delete
[2853] Fix | Delete
$style .= et_builder_set_element_font_style( 'text-decoration', $is_font_line_through_default, $is_font_line_through, 'none', 'line-through', $use_important );
[2854] Fix | Delete
[2855] Fix | Delete
$style .= et_builder_set_element_font_style( 'text-decoration-style', ( '' !== $font_line_style_default ), ( '' !== $font_line_style ), 'solid', $font_line_style, $use_important );
[2856] Fix | Delete
[2857] Fix | Delete
$style .= et_builder_set_element_font_style( '-webkit-text-decoration-color', ( '' !== $font_line_color_default ), ( '' !== $font_line_color ), '', $font_line_color, $use_important );
[2858] Fix | Delete
$style .= et_builder_set_element_font_style( 'text-decoration-color', ( '' !== $font_line_color_default ), ( '' !== $font_line_color ), '', $font_line_color, $use_important );
[2859] Fix | Delete
[2860] Fix | Delete
$style = rtrim( $style );
[2861] Fix | Delete
}
[2862] Fix | Delete
[2863] Fix | Delete
return $style;
[2864] Fix | Delete
}
[2865] Fix | Delete
endif;
[2866] Fix | Delete
[2867] Fix | Delete
if ( ! function_exists( 'et_builder_set_element_font_style' ) ) :
[2868] Fix | Delete
/**
[2869] Fix | Delete
* Set element font style.
[2870] Fix | Delete
*
[2871] Fix | Delete
* @param string $property CSS property.
[2872] Fix | Delete
* @param bool $default @todo Add parameter doc.
[2873] Fix | Delete
* @param bool $value @todo Add parameter doc.
[2874] Fix | Delete
* @param string $property_default @todo Add parameter doc.
[2875] Fix | Delete
* @param string $property_value Property value.
[2876] Fix | Delete
* @param string $use_important Whether use !important specificity.
[2877] Fix | Delete
*/
[2878] Fix | Delete
function et_builder_set_element_font_style( $property, $default, $value, $property_default, $property_value, $use_important ) {
[2879] Fix | Delete
$style = '';
[2880] Fix | Delete
[2881] Fix | Delete
if ( $value && ! $default ) {
[2882] Fix | Delete
$style = sprintf(
[2883] Fix | Delete
'%1$s: %2$s%3$s; ',
[2884] Fix | Delete
esc_html( $property ),
[2885] Fix | Delete
$property_value,
[2886] Fix | Delete
( $use_important ? ' !important' : '' )
[2887] Fix | Delete
);
[2888] Fix | Delete
} elseif ( ! $value && $default ) {
[2889] Fix | Delete
$style = sprintf(
[2890] Fix | Delete
'%1$s: %2$s%3$s; ',
[2891] Fix | Delete
esc_html( $property ),
[2892] Fix | Delete
$property_default,
[2893] Fix | Delete
( $use_important ? ' !important' : '' )
[2894] Fix | Delete
);
[2895] Fix | Delete
}
[2896] Fix | Delete
[2897] Fix | Delete
return $style;
[2898] Fix | Delete
}
[2899] Fix | Delete
endif;
[2900] Fix | Delete
[2901] Fix | Delete
if ( ! function_exists( 'et_builder_set_reset_font_style' ) ) :
[2902] Fix | Delete
/**
[2903] Fix | Delete
* Set reset CSS style declaration to normalize the existing font styles value from another font
[2904] Fix | Delete
* options group.
[2905] Fix | Delete
*
[2906] Fix | Delete
* @since 3.23
[2907] Fix | Delete
*
[2908] Fix | Delete
* @param string $current_value Current font option value.
[2909] Fix | Delete
* @param string $compared_value Compared or parent font option value.
[2910] Fix | Delete
* @param boolean $use_important Imporant status.
[2911] Fix | Delete
* @return string Generated reset font styles.
[2912] Fix | Delete
*/
[2913] Fix | Delete
function et_builder_set_reset_font_style( $current_value, $compared_value, $use_important = false ) {
[2914] Fix | Delete
// Being save, ensure current and compared values are valid string.
[2915] Fix | Delete
if ( ! is_string( $current_value ) || ! is_string( $compared_value ) ) {
[2916] Fix | Delete
return '';
[2917] Fix | Delete
}
[2918] Fix | Delete
[2919] Fix | Delete
$current_pieces = explode( '|', $current_value );
[2920] Fix | Delete
$compared_pieces = explode( '|', $compared_value );
[2921] Fix | Delete
if ( empty( $current_pieces ) || empty( $compared_pieces ) ) {
[2922] Fix | Delete
return '';
[2923] Fix | Delete
}
[2924] Fix | Delete
[2925] Fix | Delete
// Current value font style status.
[2926] Fix | Delete
$is_current_italic = isset( $current_pieces[2] ) && 'on' === $current_pieces[2];
[2927] Fix | Delete
$is_current_uppercase = isset( $current_pieces[3] ) && 'on' === $current_pieces[3];
[2928] Fix | Delete
$is_current_underline = isset( $current_pieces[4] ) && 'on' === $current_pieces[4];
[2929] Fix | Delete
$is_current_small_caps = isset( $current_pieces[5] ) && 'on' === $current_pieces[5];
[2930] Fix | Delete
$is_current_line_through = isset( $current_pieces[6] ) && 'on' === $current_pieces[6];
[2931] Fix | Delete
[2932] Fix | Delete
// Compated value font style status.
[2933] Fix | Delete
$is_compared_italic = isset( $compared_pieces[2] ) && 'on' === $compared_pieces[2];
[2934] Fix | Delete
$is_compared_uppercase = isset( $compared_pieces[3] ) && 'on' === $compared_pieces[3];
[2935] Fix | Delete
$is_compared_underline = isset( $compared_pieces[4] ) && 'on' === $compared_pieces[4];
[2936] Fix | Delete
$is_compared_small_caps = isset( $compared_pieces[5] ) && 'on' === $compared_pieces[5];
[2937] Fix | Delete
$is_compared_line_through = isset( $compared_pieces[6] ) && 'on' === $compared_pieces[6];
[2938] Fix | Delete
[2939] Fix | Delete
$style = '';
[2940] Fix | Delete
$important = $use_important ? ' !important' : '';
[2941] Fix | Delete
[2942] Fix | Delete
// Reset italic.
[2943] Fix | Delete
if ( ! $is_current_italic && $is_compared_italic ) {
[2944] Fix | Delete
$style .= "font-style: normal{$important};";
[2945] Fix | Delete
}
[2946] Fix | Delete
[2947] Fix | Delete
// Reset uppercase.
[2948] Fix | Delete
if ( ! $is_current_uppercase && $is_compared_uppercase ) {
[2949] Fix | Delete
$style .= "text-transform: none{$important};";
[2950] Fix | Delete
}
[2951] Fix | Delete
[2952] Fix | Delete
// Reset small caps.
[2953] Fix | Delete
if ( ! $is_current_small_caps && $is_compared_small_caps ) {
[2954] Fix | Delete
$style .= "font-variant: none{$important};";
[2955] Fix | Delete
}
[2956] Fix | Delete
[2957] Fix | Delete
// Reset underline.
[2958] Fix | Delete
if ( ! $is_current_underline && $is_compared_underline ) {
[2959] Fix | Delete
$underline_value = $is_current_line_through || $is_compared_line_through ? 'line-through' : 'none';
[2960] Fix | Delete
$style .= "text-decoration: {$underline_value}{$important};";
[2961] Fix | Delete
}
[2962] Fix | Delete
[2963] Fix | Delete
// Reset line through.
[2964] Fix | Delete
if ( ! $is_current_line_through && $is_compared_line_through ) {
[2965] Fix | Delete
$line_through_value = $is_current_underline || $is_compared_underline ? 'underline' : 'none';
[2966] Fix | Delete
$style .= "text-decoration: {$line_through_value}{$important};";
[2967] Fix | Delete
}
[2968] Fix | Delete
[2969] Fix | Delete
return $style;
[2970] Fix | Delete
}
[2971] Fix | Delete
endif;
[2972] Fix | Delete
[2973] Fix | Delete
if ( ! function_exists( 'et_builder_get_element_style_css' ) ) :
[2974] Fix | Delete
/**
[2975] Fix | Delete
* Return element css style.
[2976] Fix | Delete
*
[2977] Fix | Delete
* @param string $value Property value.
[2978] Fix | Delete
* @param string $property Css property.
[2979] Fix | Delete
* @param bool $use_important Whether add !important specificity.
[2980] Fix | Delete
*/
[2981] Fix | Delete
function et_builder_get_element_style_css( $value, $property = 'margin', $use_important = false ) {
[2982] Fix | Delete
$style = '';
[2983] Fix | Delete
[2984] Fix | Delete
$values = explode( '|', $value );
[2985] Fix | Delete
[2986] Fix | Delete
if ( ! empty( $values ) ) {
[2987] Fix | Delete
$element_style = '';
[2988] Fix | Delete
$values = array_map( 'trim', $values );
[2989] Fix | Delete
$positions = array(
[2990] Fix | Delete
'top',
[2991] Fix | Delete
'right',
[2992] Fix | Delete
'bottom',
[2993] Fix | Delete
'left',
[2994] Fix | Delete
);
[2995] Fix | Delete
[2996] Fix | Delete
foreach ( $positions as $i => $position ) {
[2997] Fix | Delete
if ( ! isset( $values[ $i ] ) || '' === $values[ $i ] ) {
[2998] Fix | Delete
continue;
[2999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function