| @@ -7,8 +7,10 @@ | ||
| 7 | 7 | * @author Florian Schmitz, Brett Zamir, Nikolay Matsievsky, Cedric Morin, Christopher Finke, Mark Scherer, Tobias Bäthge |
| 8 | 8 | * @since 1.0.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | +declare(strict_types=1); | |
| 12 | + | |
| 11 | 13 | // Prohibit direct script loading. |
| 12 | 14 | defined( 'ABSPATH' ) || die( 'No direct script access allowed!' ); |
| 13 | 15 | |
| 14 | 16 | /** |
| @@ -72,14 +74,15 @@ | ||
| 72 | 74 | '-webkit-viewport' => 'at', |
| 73 | 75 | '-moz-viewport' => 'at', |
| 74 | 76 | '-ms-viewport' => 'at', |
| 75 | 77 | 'supports' => 'at', |
| 78 | + 'container' => 'at', | |
| 76 | 79 | ); |
| 77 | 80 | |
| 78 | 81 | /** |
| 79 | 82 | * Properties that need a value with unit. |
| 80 | 83 | * |
| 81 | - * @TODO CSS3 properties. | |
| 84 | + * @todo CSS3 properties. | |
| 82 | 85 | * @see compress_numbers(); |
| 83 | 86 | */ |
| 84 | 87 | $data['csstidy']['unit_values'] = array( |
| 85 | 88 | 'background', |
| @@ -135,9 +138,9 @@ | ||
| 135 | 138 | |
| 136 | 139 | /** |
| 137 | 140 | * Properties that allow <color> as value. |
| 138 | 141 | * |
| 139 | - * @TODO CSS3 properties | |
| 142 | + * @todo CSS3 properties | |
| 140 | 143 | * @see compress_numbers(); |
| 141 | 144 | */ |
| 142 | 145 | $data['csstidy']['color_values'] = array( 'background-color', 'border-color', 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color', 'color', 'outline-color', 'column-rule-color' ); |
| 143 | 146 | |
| @@ -143,9 +146,9 @@ | ||
| 143 | 146 | |
| 144 | 147 | /** |
| 145 | 148 | * Default values for the background properties. |
| 146 | 149 | * |
| 147 | - * @TODO Possibly property names will change during CSS3 development. | |
| 150 | + * @todo Possibly property names will change during CSS3 development. | |
| 148 | 151 | * @see dissolve_short_bg() |
| 149 | 152 | * @see merge_bg() |
| 150 | 153 | */ |
| 151 | 154 | $data['csstidy']['background_prop_default'] = array(); |
| @@ -682,8 +685,9 @@ | ||
| 682 | 685 | $data['csstidy']['all_properties']['width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; |
| 683 | 686 | $data['csstidy']['all_properties']['word-break'] = 'CSS3.0'; |
| 684 | 687 | $data['csstidy']['all_properties']['word-spacing'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; |
| 685 | 688 | $data['csstidy']['all_properties']['word-wrap'] = 'CSS3.0'; |
| 689 | +$data['csstidy']['all_properties']['writing-mode'] = 'CSS3.0'; | |
| 686 | 690 | $data['csstidy']['all_properties']['z-index'] = 'CSS2.0,CSS2.1,CSS3.0'; |
| 687 | 691 | $data['csstidy']['all_properties']['zoom'] = 'CSS3.0'; |
| 688 | 692 | $data['csstidy']['all_properties']['--custom'] = 'CSS3.0'; // Placeholder for custom properties, used in TablePress_CSSTidy::property_is_valid(). |
| 689 | 693 | |
| @@ -702,22 +706,22 @@ | ||
| 702 | 706 | * An array containing all predefined templates. |
| 703 | 707 | * |
| 704 | 708 | * @see CSSTidy::load_template() |
| 705 | 709 | */ |
| 706 | -$data['csstidy']['predefined_templates']['default'][] = ''; // string before @rule | |
| 707 | -$data['csstidy']['predefined_templates']['default'][] = " {\n"; // bracket after @-rule | |
| 708 | -$data['csstidy']['predefined_templates']['default'][] = ''; // string before selector | |
| 709 | -$data['csstidy']['predefined_templates']['default'][] = " {\n"; // bracket after selector | |
| 710 | -$data['csstidy']['predefined_templates']['default'][] = "\t"; // string before property | |
| 711 | -$data['csstidy']['predefined_templates']['default'][] = ' '; // string after property+before value | |
| 712 | -$data['csstidy']['predefined_templates']['default'][] = ';'; // string after value | |
| 713 | -$data['csstidy']['predefined_templates']['default'][] = '}'; // closing bracket - selector | |
| 714 | -$data['csstidy']['predefined_templates']['default'][] = "\n\n"; // space between blocks {...} | |
| 715 | -$data['csstidy']['predefined_templates']['default'][] = "\n}\n\n"; // closing bracket @-rule | |
| 716 | -$data['csstidy']['predefined_templates']['default'][] = "\t"; // indent in @-rule | |
| 717 | -$data['csstidy']['predefined_templates']['default'][] = ''; // before comment | |
| 718 | -$data['csstidy']['predefined_templates']['default'][] = "\n"; // after comment | |
| 719 | -$data['csstidy']['predefined_templates']['default'][] = "\n"; // after each line @-rule | |
| 710 | +$data['csstidy']['predefined_templates']['default'][] = ''; // string before @rule. | |
| 711 | +$data['csstidy']['predefined_templates']['default'][] = " {\n"; // bracket after @-rule. | |
| 712 | +$data['csstidy']['predefined_templates']['default'][] = ''; // string before selector. | |
| 713 | +$data['csstidy']['predefined_templates']['default'][] = " {\n"; // bracket after selector. | |
| 714 | +$data['csstidy']['predefined_templates']['default'][] = "\t"; // string before property. | |
| 715 | +$data['csstidy']['predefined_templates']['default'][] = ' '; // string after property+before value. | |
| 716 | +$data['csstidy']['predefined_templates']['default'][] = ';'; // string after value. | |
| 717 | +$data['csstidy']['predefined_templates']['default'][] = '}'; // closing bracket - selector. | |
| 718 | +$data['csstidy']['predefined_templates']['default'][] = "\n\n"; // space between blocks {...}. | |
| 719 | +$data['csstidy']['predefined_templates']['default'][] = "\n}\n\n"; // closing bracket @-rule. | |
| 720 | +$data['csstidy']['predefined_templates']['default'][] = "\t"; // indent in @-rule. | |
| 721 | +$data['csstidy']['predefined_templates']['default'][] = ''; // before comment. | |
| 722 | +$data['csstidy']['predefined_templates']['default'][] = "\n"; // after comment. | |
| 723 | +$data['csstidy']['predefined_templates']['default'][] = "\n"; // after each line @-rule. | |
| 720 | 724 | |
| 721 | 725 | $data['csstidy']['predefined_templates']['low'][] = '<span class="at">'; |
| 722 | 726 | $data['csstidy']['predefined_templates']['low'][] = '</span> <span class="format">{</span>' . "\n"; |
| 723 | 727 | $data['csstidy']['predefined_templates']['low'][] = '<span class="selector">'; |
| @@ -764,15 +768,15 @@ | ||
| 764 | 768 | $data['csstidy']['predefined_templates']['highest'][] = ''; |
| 765 | 769 | |
| 766 | 770 | // Support browser prefixes for properties only in the latest CSS draft. |
| 767 | 771 | foreach ( $data['csstidy']['all_properties'] as $property => $levels ) { |
| 768 | - if ( false === strpos( $levels, ',' ) ) { | |
| 772 | + if ( ! str_contains( $levels, ',' ) ) { | |
| 769 | 773 | $data['csstidy']['all_properties'][ '-moz-' . $property ] = $levels; |
| 770 | 774 | $data['csstidy']['all_properties'][ '-webkit-' . $property ] = $levels; |
| 771 | 775 | $data['csstidy']['all_properties'][ '-ms-' . $property ] = $levels; |
| 772 | 776 | $data['csstidy']['all_properties'][ '-o-' . $property ] = $levels; |
| 773 | 777 | |
| 774 | - if ( in_array( $property, $data['csstidy']['unit_values'] ) ) { | |
| 778 | + if ( in_array( $property, $data['csstidy']['unit_values'], true ) ) { | |
| 775 | 779 | $data['csstidy']['unit_values'][] = '-moz-' . $property; |
| 776 | 780 | $data['csstidy']['unit_values'][] = '-webkit-' . $property; |
| 777 | 781 | $data['csstidy']['unit_values'][] = '-ms-' . $property; |
| 778 | 782 | $data['csstidy']['unit_values'][] = '-o-' . $property; |
| @@ -777,9 +781,9 @@ | ||
| 777 | 781 | $data['csstidy']['unit_values'][] = '-ms-' . $property; |
| 778 | 782 | $data['csstidy']['unit_values'][] = '-o-' . $property; |
| 779 | 783 | } |
| 780 | 784 | |
| 781 | - if ( in_array( $property, $data['csstidy']['color_values'] ) ) { | |
| 785 | + if ( in_array( $property, $data['csstidy']['color_values'], true ) ) { | |
| 782 | 786 | $data['csstidy']['color_values'][] = '-moz-' . $property; |
| 783 | 787 | $data['csstidy']['color_values'][] = '-webkit-' . $property; |
| 784 | 788 | $data['csstidy']['color_values'][] = '-ms-' . $property; |
| 785 | 789 | $data['csstidy']['color_values'][] = '-o-' . $property; |
| @@ -834,6 +838,17 @@ | ||
| 834 | 838 | $data['csstidy']['all_properties']['font-variant-position'] = 'CSS3.0'; |
| 835 | 839 | $data['csstidy']['all_properties']['font-variation-settings'] = 'CSS3.0'; |
| 836 | 840 | $data['csstidy']['all_properties']['line-height-step'] = 'CSS3.0'; |
| 837 | 841 | $data['csstidy']['all_properties']['-webkit-text-fill-color'] = 'CSS3.0'; |
| 842 | +$data['csstidy']['all_properties']['-webkit-backdrop-filter'] = 'CSS3.0'; | |
| 843 | +$data['csstidy']['all_properties']['backdrop-filter'] = 'CSS3.0'; | |
| 844 | +$data['csstidy']['all_properties']['-webkit-box-orient'] = 'CSS3.0'; | |
| 845 | +$data['csstidy']['all_properties']['-webkit-line-clamp'] = 'CSS3.0'; | |
| 846 | +$data['csstidy']['all_properties']['-webkit-box-orient'] = 'CSS3.0'; | |
| 847 | +$data['csstidy']['all_properties']['contain'] = 'CSS3.0'; | |
| 848 | +$data['csstidy']['all_properties']['contain-intrinsic-size'] = 'CSS3.0'; | |
| 849 | +$data['csstidy']['all_properties']['container'] = 'CSS3.0'; | |
| 850 | +$data['csstidy']['all_properties']['container-name'] = 'CSS3.0'; | |
| 851 | +$data['csstidy']['all_properties']['container-type'] = 'CSS3.0'; | |
| 852 | +$data['csstidy']['all_properties']['content-visibility'] = 'CSS3.0'; | |
| 838 | 853 | |
| 839 | 854 | return $data; |