PluginProbe
TableKit – WordPress Table Builder for Data Tables, WooCommerce Product Tables & Post Tables / 2.3.0
TableKit – WordPress Table Builder for Data Tables, WooCommerce Product Tables & Post Tables v2.3.0
2.3.0 2.2.14 2.2.13 2.2.12 2.2.11 2.2.10 2.2.9 2.2.8 2.2.7 2.2.6 2.2.5 2.2.4 2.2.3 trunk 1.0.0 1.0.1 2.0.0 2.0.1 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2
← All changes | includes/Helpers/Utils.php +28 -23 2.2.10 → 2.3.0 View file →
@@ -545,39 +545,44 @@
545 545 if ( ! is_array( $key ) ) {
546 546 return array( 'border' => null );
547 547 }
548 548
549 - $key_length = count( $key );
549 + // Per-side border box: keys are direction names (top/right/bottom/left),
550 + // each holding its own {width, style, color}.
551 + $sides = array( 'top', 'right', 'bottom', 'left' );
552 + $is_per_side = count( array_intersect( array_keys( $key ), $sides ) ) > 0;
550 553
551 - if ( $key_length < 3 ) {
552 - $properties = array( 'style', 'color', 'width' );
553 - $border_parts = array();
554 -
555 - foreach ( $properties as $property ) {
556 - if ( isset( $key[ $property ] ) ) {
557 - $border_parts[] = $key[ $property ];
554 + if ( $is_per_side ) {
555 + $border = array();
556 + foreach ( $key as $direction => $value ) {
557 + if ( ! is_array( $value ) ) {
558 + continue;
558 559 }
560 + if ( isset( $value['width'] ) && '' !== $value['width'] ) {
561 + $color = ! empty( $value['color'] ) ? $value['color'] : 'currentColor';
562 + $style = ! empty( $value['style'] ) ? $value['style'] : 'solid';
563 + $border[ "border-{$direction}" ] = "{$value['width']} {$style} {$color}";
564 + }
559 565 }
566 + return $border;
567 + }
560 568
561 - return array( 'border' => implode( ' ', $border_parts ) );
562 -
569 + // Flat border: a defined width alone is enough to emit a declaration —
570 + // this ensures an explicit 0 always produces `border-width: 0` instead
571 + // of being silently dropped when style/color weren't also set (which
572 + // let a theme's/Elementor's default table border show through).
573 + if ( isset( $key['width'] ) && '' !== $key['width'] ) {
574 + $color = ! empty( $key['color'] ) ? $key['color'] : 'currentColor';
575 + $style = ! empty( $key['style'] ) ? $key['style'] : 'solid';
576 + return array( 'border' => "{$key['width']} {$style} {$color}" );
563 577 }
564 578
565 - if ( 3 === $key_length ) {
566 - if ( isset( $key['style'] ) ) {
567 - return array( 'border' => "{$key['width']} {$key['style']} {$key['color']}" );
568 - }
579 + if ( ! empty( $key['color'] ) ) {
580 + $style = ! empty( $key['style'] ) ? $key['style'] : 'solid';
581 + return array( 'border' => "1px {$style} {$key['color']}" );
569 582 }
570 583
571 - if ( 4 === $key_length || 3 === $key_length ) {
572 - $border = array();
573 - foreach ( $key as $direction => $value ) {
574 - if ( isset( $value['style'] ) ) {
575 - $border[ "border-{$direction}" ] = "{$value['width']} {$value['style']} {$value['color']}";
576 - }
577 - }
578 - return $border;
579 - }
584 + return array( 'border' => null );
580 585 }
581 586
582 587 /**
583 588 * Builds a CSS box-model value (margin/padding/border-radius style) from a