Changeset 3838406
- Timestamp:
- 12/01/2026 06:32:14 PM (less than one hour ago)
- Location:
- equalfix
- Files:
-
- 6 edited
- 1 copied
-
tags/1.21.1 (copied) (copied from equalfix/trunk )
-
tags/1.21.1/equalfix-accessibility.php (modified) (2 diffs)
-
tags/1.21.1/includes/class-equalfix-report.php (modified) (7 diffs)
-
tags/1.21.1/readme.txt (modified) (2 diffs)
-
trunk/equalfix-accessibility.php (modified) (2 diffs)
-
trunk/includes/class-equalfix-report.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
equalfix/tags/1.21.1/equalfix-accessibility.php
r3837977 r3838406 4 4 * Plugin URI: https://equalfix.com 5 5 * Description: Helps improve your site's accessibility by detecting specific issues and applying safe, reversible fixes to the rendered HTML. Includes a full site audit, the free fix set, and per-fix-type preview and toggle controls. 6 * Version: 1.21. 06 * Version: 1.21.1 7 7 * Requires at least: 6.0 8 8 * Requires PHP: 7.4 … … 23 23 } 24 24 25 define( 'EQUALFIX_VERSION', '1.21. 0' );25 define( 'EQUALFIX_VERSION', '1.21.1' ); 26 26 define( 'EQUALFIX_FILE', __FILE__ ); 27 27 define( 'EQUALFIX_DIR', plugin_dir_path( __FILE__ ) ); -
equalfix/tags/1.21.1/includes/class-equalfix-report.php
r3836082 r3838406 829 829 $pdf->draw_text( __( 'Your website accessibility audit', 'equalfix' ), $left, $y, 21, 'F2', $p['navy'] ); 830 830 $y -= 20; 831 $size = 9.5;832 831 $parts = array( 833 832 array( __( 'Prepared for ', 'equalfix' ), 'F1', $p['slate_soft'] ), … … 837 836 array( __( ' Generated by the EqualFix plugin', 'equalfix' ), 'F1', $p['slate_soft'] ), 838 837 ); 839 $whole = ''; 838 $avail = EqualFix_PDF::PAGE_W - 2 * EqualFix_PDF::MARGIN; 839 // The parts are tiled edge to edge, so each part is 840 // given the width it will actually occupy in a 841 // reader: the writer measures with the shared 842 // Helvetica metrics, but readers substitute the 843 // built-in bold font with faces that run wider than 844 // those metrics (a long bold web address measured 845 // about 9% wider in a real render, enough to run 846 // into the "Generated by" text). Bold parts are 847 // therefore tiled and fitted with a tenth of 848 // headroom, and the line is fitted against the 849 // widened total. 850 $advance = function ( $part, $size ) use ( $pdf ) { 851 $w = $pdf->text_width( $part[0], $size ); 852 return 'F2' === $part[1] ? $w * 1.1 : $w; 853 }; 854 $line_w = function ( $parts, $size ) use ( $advance ) { 855 $t = 0; 856 foreach ( $parts as $part ) { 857 $t += $advance( $part, $size ); 858 } 859 return $t; 860 }; 861 $size = 9.5; 862 while ( $size > 6 && $line_w( $parts, $size ) > $avail ) { 863 $size -= 0.5; 864 } 865 if ( $line_w( $parts, $size ) > $avail ) { 866 // Even the smallest size cannot fit the line: 867 // the web address, then the site name, gets 868 // only the room that is actually left, cut 869 // short with "...", so the closing part always 870 // sits clear. 871 $shorten = function ( $text, $budget, $size ) use ( $pdf ) { 872 if ( $budget <= 0 ) { 873 return '...'; 874 } 875 $dots = $pdf->text_width( '...', $size ) * 1.1; 876 $keep = strlen( $text ); 877 while ( $keep > 0 && $pdf->text_width( substr( $text, 0, $keep ), $size ) * 1.1 + $dots > $budget ) { 878 $keep--; 879 } 880 return substr( $text, 0, $keep ) . '...'; 881 }; 882 foreach ( array( 3, 1 ) as $idx ) { 883 if ( $line_w( $parts, $size ) <= $avail ) { 884 break; 885 } 886 $others = $line_w( $parts, $size ) - $advance( $parts[ $idx ], $size ); 887 $parts[ $idx ][0] = $shorten( $parts[ $idx ][0], $avail - $others, $size ); 888 } 889 } 890 $x = $left; 840 891 foreach ( $parts as $part ) { 841 $whole .= $part[0]; 842 } 843 $size = $pdf->fit_size( $whole, $size, EqualFix_PDF::PAGE_W - 2 * EqualFix_PDF::MARGIN ); 844 $x = $left; 845 foreach ( $parts as $part ) { 846 $x += $pdf->draw_text( $part[0], $x, $y, $size, $part[1], $part[2] ); 892 $pdf->draw_text( $part[0], $x, $y, $size, $part[1], $part[2] ); 893 $x += $advance( $part, $size ); 847 894 } 848 895 $pdf->set_cursor( $y - 24 ); … … 916 963 $rows_h += $row_h; 917 964 } 918 $card_h = 16 + 15 + $rows_h + 10; 965 // Legend entries, composed now because their height 966 // is one of the claims on the card height: the four 967 // largest types, then the rest as one. 968 $legend = array_slice( $ranked, 0, 4 ); 969 $rest = 0; 970 foreach ( array_slice( $ranked, 4 ) as $row ) { 971 $rest += $row['count']; 972 } 973 $names = self::type_names(); 974 // The approved design's legend uses the shortest 975 // names ("Names", not "Buttons and links"). 976 $names['names'] = __( 'Names', 'equalfix' ); 977 $legend_rows = array(); 978 foreach ( $legend as $row ) { 979 $label = isset( $names[ $row['slug'] ] ) ? $names[ $row['slug'] ] : __( 'Other issues', 'equalfix' ); 980 $legend_rows[] = array( $colors[ $row['slug'] ], $label, $row['count'] ); 981 } 982 if ( $rest > 0 ) { 983 $legend_rows[] = array( $p['slate_pale'], __( 'All other types', 'equalfix' ), $rest ); 984 } 985 $legend_h = 0; 986 foreach ( $legend_rows as $i => $lr ) { 987 $text = sprintf( /* translators: %1$s: type name, %2$d: share percent */ __( '%1$s, %2$d%%', 'equalfix' ), $lr[1], (int) round( 100 * $lr[2] / $total ) ); 988 $lines = array_slice( $pdf->wrap_text( $text, 7.8, 76 ), 0, 2 ); 989 $legend_rows[ $i ] = array( $lr[0], $lines ); 990 $legend_h += count( $lines ) * 9.5 + 4.5; 991 } 992 // The cards' height is set by whichever side needs 993 // more room: the bar rows, the legend (which starts 994 // 46 below the card top), or the donut, whose fixed 995 // diameter needs its full height below the heading 996 // plus padding top and bottom (31 + 76 + 9 = 116). 997 // With few types the bar side is short, and the 998 // donut used to be centred on the whole card, so it 999 // covered the heading and spilled past the bottom. 1000 $card_h = max( 16 + 15 + $rows_h + 10, 46 + $legend_h + 8, 116 ); 919 1001 if ( $pdf->cursor() - $card_h < EqualFix_PDF::MARGIN + 30 ) { 920 1002 $pdf->add_page(); … … 945 1027 $pdf->draw_text( __( 'SHARE OF ISSUES', 'equalfix' ), $dx + 14, $top - 20, 8.5, 'F2', $p['navy'] ); 946 1028 $cx = $dx + 56; 947 $cy = $bot + ( $card_h - 30 ) / 2 + 4; 1029 // Centred in the space below the heading (the 1030 // heading zone is 31, the bottom padding 6), so the 1031 // donut never reaches the heading or the card edge. 1032 $cy = $bot + ( $card_h - 25 ) / 2; 948 1033 $a = 90.0; 949 1034 foreach ( $ranked as $row ) { … … 956 1041 $pdf->draw_text( (string) $total, $cx, $cy + 1, 15, 'F2', $p['navy'], 'center' ); 957 1042 $pdf->draw_text( __( 'issues', 'equalfix' ), $cx, $cy - 11, 7.5, 'F1', $p['slate_soft'], 'center' ); 958 // Legend: the four largest types, then the rest as one. 959 $legend = array_slice( $ranked, 0, 4 ); 960 $rest = 0; 961 foreach ( array_slice( $ranked, 4 ) as $row ) { 962 $rest += $row['count']; 963 } 964 $names = self::type_names(); 965 // The approved design's legend uses the shortest 966 // names ("Names", not "Buttons and links"). 967 $names['names'] = __( 'Names', 'equalfix' ); 968 $ly = $top - 46; 969 foreach ( $legend as $row ) { 970 $label = isset( $names[ $row['slug'] ] ) ? $names[ $row['slug'] ] : __( 'Other issues', 'equalfix' ); 971 $ly = self::legend_row( $pdf, $dx + 106, $ly, $colors[ $row['slug'] ], $label, $row['count'], $total ); 972 } 973 if ( $rest > 0 ) { 974 self::legend_row( $pdf, $dx + 106, $ly, $p['slate_pale'], __( 'All other types', 'equalfix' ), $rest, $total ); 1043 $ly = $top - 46; 1044 foreach ( $legend_rows as $lr ) { 1045 $ly = self::legend_lines( $pdf, $dx + 106, $ly, $lr[0], $lr[1] ); 975 1046 } 976 1047 $pdf->set_cursor( $bot - 18 ); … … 978 1049 979 1050 /** 980 * One donut legend row; returns the next row's top. 1051 * One donut legend row, drawn from the lines the 1052 * layout measured when it sized the card; returns 1053 * the next row's top. 981 1054 * 982 1055 * @param EqualFix_PDF $pdf Writer. … … 984 1057 * @param float $top Row top. 985 1058 * @param string $color Dot colour. 986 * @param string $label Short type name. 987 * @param int $count Issues of this type. 988 * @param int $total True issue total. 1059 * @param array $lines Wrapped label lines. 989 1060 * @return float 990 1061 */ 991 private static function legend_row( $pdf, $x, $top, $color, $label, $count, $total ) { 992 $p = self::palette(); 993 $text = sprintf( /* translators: %1$s: type name, %2$d: share percent */ __( '%1$s, %2$d%%', 'equalfix' ), $label, (int) round( 100 * $count / $total ) ); 994 $lines = array_slice( $pdf->wrap_text( $text, 7.8, 76 ), 0, 2 ); 1062 private static function legend_lines( $pdf, $x, $top, $color, $lines ) { 1063 $p = self::palette(); 995 1064 $pdf->draw_rect( $x, $top - 7, 6, 6, $color, null, 1.5 ); 996 1065 $ly = $top - 6; -
equalfix/tags/1.21.1/readme.txt
r3837977 r3838406 5 5 Tested up to: 7.1.4 6 6 Requires PHP: 7.4 7 Stable tag: 1.21. 07 Stable tag: 1.21.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 155 155 == Changelog == 156 156 157 = 1.21.1 = 158 * Report layout fixes: a long web address can no longer run into the "Generated by the EqualFix plugin" line in the report header, and the share-of-issues chart no longer crowds its panel on reports with only a few issue types. 159 157 160 = 1.21.0 = 158 161 * Pro fixes now take one click (with Pro 1.16.0): turning the Pro fixes switch on also drafts alt text for the images in your latest check that need a description and applies the drafts for you. The separate trip to Issues to draft and approve each batch is gone. -
equalfix/trunk/equalfix-accessibility.php
r3837977 r3838406 4 4 * Plugin URI: https://equalfix.com 5 5 * Description: Helps improve your site's accessibility by detecting specific issues and applying safe, reversible fixes to the rendered HTML. Includes a full site audit, the free fix set, and per-fix-type preview and toggle controls. 6 * Version: 1.21. 06 * Version: 1.21.1 7 7 * Requires at least: 6.0 8 8 * Requires PHP: 7.4 … … 23 23 } 24 24 25 define( 'EQUALFIX_VERSION', '1.21. 0' );25 define( 'EQUALFIX_VERSION', '1.21.1' ); 26 26 define( 'EQUALFIX_FILE', __FILE__ ); 27 27 define( 'EQUALFIX_DIR', plugin_dir_path( __FILE__ ) ); -
equalfix/trunk/includes/class-equalfix-report.php
r3836082 r3838406 829 829 $pdf->draw_text( __( 'Your website accessibility audit', 'equalfix' ), $left, $y, 21, 'F2', $p['navy'] ); 830 830 $y -= 20; 831 $size = 9.5;832 831 $parts = array( 833 832 array( __( 'Prepared for ', 'equalfix' ), 'F1', $p['slate_soft'] ), … … 837 836 array( __( ' Generated by the EqualFix plugin', 'equalfix' ), 'F1', $p['slate_soft'] ), 838 837 ); 839 $whole = ''; 838 $avail = EqualFix_PDF::PAGE_W - 2 * EqualFix_PDF::MARGIN; 839 // The parts are tiled edge to edge, so each part is 840 // given the width it will actually occupy in a 841 // reader: the writer measures with the shared 842 // Helvetica metrics, but readers substitute the 843 // built-in bold font with faces that run wider than 844 // those metrics (a long bold web address measured 845 // about 9% wider in a real render, enough to run 846 // into the "Generated by" text). Bold parts are 847 // therefore tiled and fitted with a tenth of 848 // headroom, and the line is fitted against the 849 // widened total. 850 $advance = function ( $part, $size ) use ( $pdf ) { 851 $w = $pdf->text_width( $part[0], $size ); 852 return 'F2' === $part[1] ? $w * 1.1 : $w; 853 }; 854 $line_w = function ( $parts, $size ) use ( $advance ) { 855 $t = 0; 856 foreach ( $parts as $part ) { 857 $t += $advance( $part, $size ); 858 } 859 return $t; 860 }; 861 $size = 9.5; 862 while ( $size > 6 && $line_w( $parts, $size ) > $avail ) { 863 $size -= 0.5; 864 } 865 if ( $line_w( $parts, $size ) > $avail ) { 866 // Even the smallest size cannot fit the line: 867 // the web address, then the site name, gets 868 // only the room that is actually left, cut 869 // short with "...", so the closing part always 870 // sits clear. 871 $shorten = function ( $text, $budget, $size ) use ( $pdf ) { 872 if ( $budget <= 0 ) { 873 return '...'; 874 } 875 $dots = $pdf->text_width( '...', $size ) * 1.1; 876 $keep = strlen( $text ); 877 while ( $keep > 0 && $pdf->text_width( substr( $text, 0, $keep ), $size ) * 1.1 + $dots > $budget ) { 878 $keep--; 879 } 880 return substr( $text, 0, $keep ) . '...'; 881 }; 882 foreach ( array( 3, 1 ) as $idx ) { 883 if ( $line_w( $parts, $size ) <= $avail ) { 884 break; 885 } 886 $others = $line_w( $parts, $size ) - $advance( $parts[ $idx ], $size ); 887 $parts[ $idx ][0] = $shorten( $parts[ $idx ][0], $avail - $others, $size ); 888 } 889 } 890 $x = $left; 840 891 foreach ( $parts as $part ) { 841 $whole .= $part[0]; 842 } 843 $size = $pdf->fit_size( $whole, $size, EqualFix_PDF::PAGE_W - 2 * EqualFix_PDF::MARGIN ); 844 $x = $left; 845 foreach ( $parts as $part ) { 846 $x += $pdf->draw_text( $part[0], $x, $y, $size, $part[1], $part[2] ); 892 $pdf->draw_text( $part[0], $x, $y, $size, $part[1], $part[2] ); 893 $x += $advance( $part, $size ); 847 894 } 848 895 $pdf->set_cursor( $y - 24 ); … … 916 963 $rows_h += $row_h; 917 964 } 918 $card_h = 16 + 15 + $rows_h + 10; 965 // Legend entries, composed now because their height 966 // is one of the claims on the card height: the four 967 // largest types, then the rest as one. 968 $legend = array_slice( $ranked, 0, 4 ); 969 $rest = 0; 970 foreach ( array_slice( $ranked, 4 ) as $row ) { 971 $rest += $row['count']; 972 } 973 $names = self::type_names(); 974 // The approved design's legend uses the shortest 975 // names ("Names", not "Buttons and links"). 976 $names['names'] = __( 'Names', 'equalfix' ); 977 $legend_rows = array(); 978 foreach ( $legend as $row ) { 979 $label = isset( $names[ $row['slug'] ] ) ? $names[ $row['slug'] ] : __( 'Other issues', 'equalfix' ); 980 $legend_rows[] = array( $colors[ $row['slug'] ], $label, $row['count'] ); 981 } 982 if ( $rest > 0 ) { 983 $legend_rows[] = array( $p['slate_pale'], __( 'All other types', 'equalfix' ), $rest ); 984 } 985 $legend_h = 0; 986 foreach ( $legend_rows as $i => $lr ) { 987 $text = sprintf( /* translators: %1$s: type name, %2$d: share percent */ __( '%1$s, %2$d%%', 'equalfix' ), $lr[1], (int) round( 100 * $lr[2] / $total ) ); 988 $lines = array_slice( $pdf->wrap_text( $text, 7.8, 76 ), 0, 2 ); 989 $legend_rows[ $i ] = array( $lr[0], $lines ); 990 $legend_h += count( $lines ) * 9.5 + 4.5; 991 } 992 // The cards' height is set by whichever side needs 993 // more room: the bar rows, the legend (which starts 994 // 46 below the card top), or the donut, whose fixed 995 // diameter needs its full height below the heading 996 // plus padding top and bottom (31 + 76 + 9 = 116). 997 // With few types the bar side is short, and the 998 // donut used to be centred on the whole card, so it 999 // covered the heading and spilled past the bottom. 1000 $card_h = max( 16 + 15 + $rows_h + 10, 46 + $legend_h + 8, 116 ); 919 1001 if ( $pdf->cursor() - $card_h < EqualFix_PDF::MARGIN + 30 ) { 920 1002 $pdf->add_page(); … … 945 1027 $pdf->draw_text( __( 'SHARE OF ISSUES', 'equalfix' ), $dx + 14, $top - 20, 8.5, 'F2', $p['navy'] ); 946 1028 $cx = $dx + 56; 947 $cy = $bot + ( $card_h - 30 ) / 2 + 4; 1029 // Centred in the space below the heading (the 1030 // heading zone is 31, the bottom padding 6), so the 1031 // donut never reaches the heading or the card edge. 1032 $cy = $bot + ( $card_h - 25 ) / 2; 948 1033 $a = 90.0; 949 1034 foreach ( $ranked as $row ) { … … 956 1041 $pdf->draw_text( (string) $total, $cx, $cy + 1, 15, 'F2', $p['navy'], 'center' ); 957 1042 $pdf->draw_text( __( 'issues', 'equalfix' ), $cx, $cy - 11, 7.5, 'F1', $p['slate_soft'], 'center' ); 958 // Legend: the four largest types, then the rest as one. 959 $legend = array_slice( $ranked, 0, 4 ); 960 $rest = 0; 961 foreach ( array_slice( $ranked, 4 ) as $row ) { 962 $rest += $row['count']; 963 } 964 $names = self::type_names(); 965 // The approved design's legend uses the shortest 966 // names ("Names", not "Buttons and links"). 967 $names['names'] = __( 'Names', 'equalfix' ); 968 $ly = $top - 46; 969 foreach ( $legend as $row ) { 970 $label = isset( $names[ $row['slug'] ] ) ? $names[ $row['slug'] ] : __( 'Other issues', 'equalfix' ); 971 $ly = self::legend_row( $pdf, $dx + 106, $ly, $colors[ $row['slug'] ], $label, $row['count'], $total ); 972 } 973 if ( $rest > 0 ) { 974 self::legend_row( $pdf, $dx + 106, $ly, $p['slate_pale'], __( 'All other types', 'equalfix' ), $rest, $total ); 1043 $ly = $top - 46; 1044 foreach ( $legend_rows as $lr ) { 1045 $ly = self::legend_lines( $pdf, $dx + 106, $ly, $lr[0], $lr[1] ); 975 1046 } 976 1047 $pdf->set_cursor( $bot - 18 ); … … 978 1049 979 1050 /** 980 * One donut legend row; returns the next row's top. 1051 * One donut legend row, drawn from the lines the 1052 * layout measured when it sized the card; returns 1053 * the next row's top. 981 1054 * 982 1055 * @param EqualFix_PDF $pdf Writer. … … 984 1057 * @param float $top Row top. 985 1058 * @param string $color Dot colour. 986 * @param string $label Short type name. 987 * @param int $count Issues of this type. 988 * @param int $total True issue total. 1059 * @param array $lines Wrapped label lines. 989 1060 * @return float 990 1061 */ 991 private static function legend_row( $pdf, $x, $top, $color, $label, $count, $total ) { 992 $p = self::palette(); 993 $text = sprintf( /* translators: %1$s: type name, %2$d: share percent */ __( '%1$s, %2$d%%', 'equalfix' ), $label, (int) round( 100 * $count / $total ) ); 994 $lines = array_slice( $pdf->wrap_text( $text, 7.8, 76 ), 0, 2 ); 1062 private static function legend_lines( $pdf, $x, $top, $color, $lines ) { 1063 $p = self::palette(); 995 1064 $pdf->draw_rect( $x, $top - 7, 6, 6, $color, null, 1.5 ); 996 1065 $ly = $top - 6; -
equalfix/trunk/readme.txt
r3837977 r3838406 5 5 Tested up to: 7.1.4 6 6 Requires PHP: 7.4 7 Stable tag: 1.21. 07 Stable tag: 1.21.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 155 155 == Changelog == 156 156 157 = 1.21.1 = 158 * Report layout fixes: a long web address can no longer run into the "Generated by the EqualFix plugin" line in the report header, and the share-of-issues chart no longer crowds its panel on reports with only a few issue types. 159 157 160 = 1.21.0 = 158 161 * Pro fixes now take one click (with Pro 1.16.0): turning the Pro fixes switch on also drafts alt text for the images in your latest check that need a description and applies the drafts for you. The separate trip to Issues to draft and approve each batch is gone.
Note:
See TracChangeset
for help on using the changeset viewer.