Changeset 3433059
- Timestamp:
- 01/05/2026 08:40:50 PM (2 months ago)
- Location:
- awesome-footnotes
- Files:
-
- 6 edited
- 1 copied
-
tags/3.9.3 (copied) (copied from awesome-footnotes/trunk)
-
tags/3.9.3/awesome-footnotes.php (modified) (2 diffs)
-
tags/3.9.3/classes/controllers/class-footnotes-formatter.php (modified) (24 diffs)
-
tags/3.9.3/readme.txt (modified) (2 diffs)
-
trunk/awesome-footnotes.php (modified) (2 diffs)
-
trunk/classes/controllers/class-footnotes-formatter.php (modified) (24 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
awesome-footnotes/tags/3.9.3/awesome-footnotes.php
r3422097 r3433059 13 13 * Plugin Name: Footnotes 14 14 * Description: Allows post authors to easily add and manage footnotes in posts. 15 * Version: 3.9. 215 * Version: 3.9.3 16 16 * Author: Footnotes 17 17 * Author URI: https://quotecites.com … … 29 29 } 30 30 31 define( 'AWEF_VERSION', '3.9. 2' );31 define( 'AWEF_VERSION', '3.9.3' ); 32 32 define( 'AWEF_TEXTDOMAIN', 'awesome-footnotes' ); 33 33 define( 'AWEF_NAME', 'Footnotes' ); -
awesome-footnotes/tags/3.9.3/classes/controllers/class-footnotes-formatter.php
r3366051 r3433059 42 42 * @since 3.0.0 43 43 */ 44 public static $pos = 0;44 public static int $pos = 0; 45 45 46 46 /** … … 51 51 * @since 3.4.0 52 52 */ 53 public static $current_post = 0;53 public static int $current_post = 0; 54 54 55 55 /** … … 60 60 * @since 3.3.3 61 61 */ 62 public static $block_starting_pos = -1;62 public static int $block_starting_pos = -1; 63 63 64 64 /** … … 69 69 * @since 2.0.0 70 70 */ 71 private static $styles = array(71 private static array $styles = array( 72 72 'decimal' => '1,2...10', 73 73 'decimal-leading-zero' => '01, 02...10', … … 86 86 * @since 2.4.0 87 87 */ 88 private static $identifiers = array();88 private static array $identifiers = array(); 89 89 90 90 /** … … 95 95 * @since 2.0.0 96 96 */ 97 public static function init() {97 public static function init(): void { 98 98 99 99 /** … … 156 156 * @since 2.4.0 157 157 */ 158 public static function show_footnotes( $args = null ) {158 public static function show_footnotes( $args = null ): string { 159 159 global $post, $wp_current_filter; 160 160 … … 199 199 * @since 2.0.0 200 200 */ 201 public static function insert_styles( $post_id = null ){201 public static function insert_styles( ?int $post_id = null ): void { 202 202 if ( null === $post_id ) { 203 203 $post_id = 0; … … 222 222 * @since 2.0.0 223 223 */ 224 public static function register_script() {224 public static function register_script(): void { 225 225 if ( Settings::get_current_options()['pretty_tooltips'] ) { 226 226 \wp_register_script( … … 264 264 * @since 2.0.0 265 265 */ 266 public static function print_script() {266 public static function print_script(): void { 267 267 if ( Settings::get_current_options()['pretty_tooltips'] ) { 268 268 \wp_print_scripts( 'wp-footnotes-tooltips' ); … … 300 300 * @since 2.0.0 301 301 */ 302 public static function process( $data ) {302 public static function process( $data ): string { 303 303 304 304 global $post, $wp_current_filter; … … 433 433 foreach ( $identifiers as $key => $identifier ) { 434 434 435 $id_id = self::HTML_TAG_NAME . $key + $start_number . '_' .$inner_post->ID;436 437 $id_num_text = ( 'decimal' === $style ) ? $identifier['position_number'] : self::convert_num( $identifier['use_footnote'] + $start_number, $style,$key );435 $id_id = self::HTML_TAG_NAME . ( (int) $key + (int) $start_number ) . '_' . (int) $inner_post->ID; 436 437 $id_num_text = ( 'decimal' === $style ) ? $identifier['position_number'] : self::convert_num( (int) $identifier['use_footnote'] + (int) $start_number, $style, (int) $key ); 438 438 439 439 $id_href = ( ( $use_full_link ) ? \get_permalink( $inner_post->ID ) : '' ) . '#footnote_' . ( $identifier['use_footnote'] + $start_number ) . '_' . $inner_post->ID; … … 675 675 $footnotes_block .= '>'; 676 676 if ( 'symbol' === $style ) { 677 $footnotes_block .= '<span class="symbol">' . self::convert_num( $key + $start_number, $style,$key ) . '</span> ';677 $footnotes_block .= '<span class="symbol">' . self::convert_num( (int) $key + (int) $start_number, $style, (int) $key ) . '</span> '; 678 678 } 679 679 $footnotes_block .= ( ( $before_position ) ? $foot_links : '' ); … … 732 732 * @since 3.7.0 733 733 */ 734 public static function get_template( string $subfolder, string $file ) {734 public static function get_template( string $subfolder, string $file ): void { 735 735 $real_file = $file . '.php'; 736 736 … … 763 763 * @since 2.0.0 764 764 */ 765 public static function get_style( ?\WP_Post $post = null ) { 765 public static function get_style( ?\WP_Post $post = null ): string { 766 // If no post provided, fall back to options. 767 if ( ! $post ) { 768 return (string) Settings::get_current_options()['list_style_type']; 769 } 770 766 771 // Check if this post is using a different list style to the settings. 767 772 if ( \get_post_meta( $post->ID, 'footnote_style', true ) && array_key_exists( \get_post_meta( $post->ID, 'footnote_style', true ), self::$styles ) ) { … … 771 776 } 772 777 773 return $style;778 return (string) $style; 774 779 } 775 780 … … 858 863 * @since 2.3.0 859 864 */ 860 public static function mb_substr_replace( $original, $replacement, $position,$length ): string {865 public static function mb_substr_replace( string $original, string $replacement, int $position, int $length ): string { 861 866 $start_string = mb_substr( $original, 0, $position, 'UTF-8' ); 862 867 $end_string = mb_substr( $original, $position + $length, mb_strlen( $original ), 'UTF-8' ); … … 872 877 * Convert number to a specific style 873 878 * 874 * @param string$num The number to be converted.879 * @param int $num The number to be converted. 875 880 * @param string $style The style of output required. 876 * @param string$total The total length.881 * @param int $total The total length. 877 882 * 878 883 * @return string The converted number … … 880 885 * @since 2.0.0 881 886 */ 882 public static function convert_num( $num, $style, $total ){887 public static function convert_num( int $num, string $style, int $total ): string { 883 888 884 889 switch ( $style ) { … … 904 909 return $sym; 905 910 default: 906 return $num;911 return (string) $num; 907 912 } 908 913 } … … 920 925 * @since 2.0.0 921 926 */ 922 public static function roman( $num, $letter_case = 'upper' ){927 public static function roman( int $num, string $letter_case = 'upper' ): string { 923 928 924 929 $num = (int) $num; … … 959 964 * @since 2.0.0 960 965 */ 961 public static function alpha( $num, $target_case = 'upper' ){966 public static function alpha( int $num, string $target_case = 'upper' ): string { 962 967 $num = (int) $num; 963 968 … … 973 978 ++$j; 974 979 } 980 981 return ''; 975 982 } 976 983 … … 993 1000 * @since 3.8.1 994 1001 */ 995 public static function clear_vars() {1002 public static function clear_vars(): void { 996 1003 self::$pos = 0; 997 1004 self::$block_starting_pos = -1; -
awesome-footnotes/tags/3.9.3/readme.txt
r3429715 r3433059 4 4 Tested up to: 6.9 5 5 Requires PHP: 7.4 6 Stable tag: 3.9. 26 Stable tag: 3.9.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 189 189 == Change Log == 190 190 191 = 3.9.3 = 192 Added more strict typification in the formatter class. 193 191 194 = 3.9.2 = 192 195 Extended TOC options. Code optimization and bug fixes. New WordPress version support. Added primary category selector for SEO. -
awesome-footnotes/trunk/awesome-footnotes.php
r3422097 r3433059 13 13 * Plugin Name: Footnotes 14 14 * Description: Allows post authors to easily add and manage footnotes in posts. 15 * Version: 3.9. 215 * Version: 3.9.3 16 16 * Author: Footnotes 17 17 * Author URI: https://quotecites.com … … 29 29 } 30 30 31 define( 'AWEF_VERSION', '3.9. 2' );31 define( 'AWEF_VERSION', '3.9.3' ); 32 32 define( 'AWEF_TEXTDOMAIN', 'awesome-footnotes' ); 33 33 define( 'AWEF_NAME', 'Footnotes' ); -
awesome-footnotes/trunk/classes/controllers/class-footnotes-formatter.php
r3366051 r3433059 42 42 * @since 3.0.0 43 43 */ 44 public static $pos = 0;44 public static int $pos = 0; 45 45 46 46 /** … … 51 51 * @since 3.4.0 52 52 */ 53 public static $current_post = 0;53 public static int $current_post = 0; 54 54 55 55 /** … … 60 60 * @since 3.3.3 61 61 */ 62 public static $block_starting_pos = -1;62 public static int $block_starting_pos = -1; 63 63 64 64 /** … … 69 69 * @since 2.0.0 70 70 */ 71 private static $styles = array(71 private static array $styles = array( 72 72 'decimal' => '1,2...10', 73 73 'decimal-leading-zero' => '01, 02...10', … … 86 86 * @since 2.4.0 87 87 */ 88 private static $identifiers = array();88 private static array $identifiers = array(); 89 89 90 90 /** … … 95 95 * @since 2.0.0 96 96 */ 97 public static function init() {97 public static function init(): void { 98 98 99 99 /** … … 156 156 * @since 2.4.0 157 157 */ 158 public static function show_footnotes( $args = null ) {158 public static function show_footnotes( $args = null ): string { 159 159 global $post, $wp_current_filter; 160 160 … … 199 199 * @since 2.0.0 200 200 */ 201 public static function insert_styles( $post_id = null ){201 public static function insert_styles( ?int $post_id = null ): void { 202 202 if ( null === $post_id ) { 203 203 $post_id = 0; … … 222 222 * @since 2.0.0 223 223 */ 224 public static function register_script() {224 public static function register_script(): void { 225 225 if ( Settings::get_current_options()['pretty_tooltips'] ) { 226 226 \wp_register_script( … … 264 264 * @since 2.0.0 265 265 */ 266 public static function print_script() {266 public static function print_script(): void { 267 267 if ( Settings::get_current_options()['pretty_tooltips'] ) { 268 268 \wp_print_scripts( 'wp-footnotes-tooltips' ); … … 300 300 * @since 2.0.0 301 301 */ 302 public static function process( $data ) {302 public static function process( $data ): string { 303 303 304 304 global $post, $wp_current_filter; … … 433 433 foreach ( $identifiers as $key => $identifier ) { 434 434 435 $id_id = self::HTML_TAG_NAME . $key + $start_number . '_' .$inner_post->ID;436 437 $id_num_text = ( 'decimal' === $style ) ? $identifier['position_number'] : self::convert_num( $identifier['use_footnote'] + $start_number, $style,$key );435 $id_id = self::HTML_TAG_NAME . ( (int) $key + (int) $start_number ) . '_' . (int) $inner_post->ID; 436 437 $id_num_text = ( 'decimal' === $style ) ? $identifier['position_number'] : self::convert_num( (int) $identifier['use_footnote'] + (int) $start_number, $style, (int) $key ); 438 438 439 439 $id_href = ( ( $use_full_link ) ? \get_permalink( $inner_post->ID ) : '' ) . '#footnote_' . ( $identifier['use_footnote'] + $start_number ) . '_' . $inner_post->ID; … … 675 675 $footnotes_block .= '>'; 676 676 if ( 'symbol' === $style ) { 677 $footnotes_block .= '<span class="symbol">' . self::convert_num( $key + $start_number, $style,$key ) . '</span> ';677 $footnotes_block .= '<span class="symbol">' . self::convert_num( (int) $key + (int) $start_number, $style, (int) $key ) . '</span> '; 678 678 } 679 679 $footnotes_block .= ( ( $before_position ) ? $foot_links : '' ); … … 732 732 * @since 3.7.0 733 733 */ 734 public static function get_template( string $subfolder, string $file ) {734 public static function get_template( string $subfolder, string $file ): void { 735 735 $real_file = $file . '.php'; 736 736 … … 763 763 * @since 2.0.0 764 764 */ 765 public static function get_style( ?\WP_Post $post = null ) { 765 public static function get_style( ?\WP_Post $post = null ): string { 766 // If no post provided, fall back to options. 767 if ( ! $post ) { 768 return (string) Settings::get_current_options()['list_style_type']; 769 } 770 766 771 // Check if this post is using a different list style to the settings. 767 772 if ( \get_post_meta( $post->ID, 'footnote_style', true ) && array_key_exists( \get_post_meta( $post->ID, 'footnote_style', true ), self::$styles ) ) { … … 771 776 } 772 777 773 return $style;778 return (string) $style; 774 779 } 775 780 … … 858 863 * @since 2.3.0 859 864 */ 860 public static function mb_substr_replace( $original, $replacement, $position,$length ): string {865 public static function mb_substr_replace( string $original, string $replacement, int $position, int $length ): string { 861 866 $start_string = mb_substr( $original, 0, $position, 'UTF-8' ); 862 867 $end_string = mb_substr( $original, $position + $length, mb_strlen( $original ), 'UTF-8' ); … … 872 877 * Convert number to a specific style 873 878 * 874 * @param string$num The number to be converted.879 * @param int $num The number to be converted. 875 880 * @param string $style The style of output required. 876 * @param string$total The total length.881 * @param int $total The total length. 877 882 * 878 883 * @return string The converted number … … 880 885 * @since 2.0.0 881 886 */ 882 public static function convert_num( $num, $style, $total ){887 public static function convert_num( int $num, string $style, int $total ): string { 883 888 884 889 switch ( $style ) { … … 904 909 return $sym; 905 910 default: 906 return $num;911 return (string) $num; 907 912 } 908 913 } … … 920 925 * @since 2.0.0 921 926 */ 922 public static function roman( $num, $letter_case = 'upper' ){927 public static function roman( int $num, string $letter_case = 'upper' ): string { 923 928 924 929 $num = (int) $num; … … 959 964 * @since 2.0.0 960 965 */ 961 public static function alpha( $num, $target_case = 'upper' ){966 public static function alpha( int $num, string $target_case = 'upper' ): string { 962 967 $num = (int) $num; 963 968 … … 973 978 ++$j; 974 979 } 980 981 return ''; 975 982 } 976 983 … … 993 1000 * @since 3.8.1 994 1001 */ 995 public static function clear_vars() {1002 public static function clear_vars(): void { 996 1003 self::$pos = 0; 997 1004 self::$block_starting_pos = -1; -
awesome-footnotes/trunk/readme.txt
r3429715 r3433059 4 4 Tested up to: 6.9 5 5 Requires PHP: 7.4 6 Stable tag: 3.9. 26 Stable tag: 3.9.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 189 189 == Change Log == 190 190 191 = 3.9.3 = 192 Added more strict typification in the formatter class. 193 191 194 = 3.9.2 = 192 195 Extended TOC options. Code optimization and bug fixes. New WordPress version support. Added primary category selector for SEO.
Note: See TracChangeset
for help on using the changeset viewer.