Plugin Directory

Changeset 3433059


Ignore:
Timestamp:
01/05/2026 08:40:50 PM (2 months ago)
Author:
awesomefootnotes
Message:

Adding the first version of my plugin

Location:
awesome-footnotes
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • awesome-footnotes/tags/3.9.3/awesome-footnotes.php

    r3422097 r3433059  
    1313 * Plugin Name:     Footnotes
    1414 * Description:     Allows post authors to easily add and manage footnotes in posts.
    15  * Version:         3.9.2
     15 * Version:         3.9.3
    1616 * Author:          Footnotes
    1717 * Author URI:      https://quotecites.com
     
    2929}
    3030
    31 define( 'AWEF_VERSION', '3.9.2' );
     31define( 'AWEF_VERSION', '3.9.3' );
    3232define( 'AWEF_TEXTDOMAIN', 'awesome-footnotes' );
    3333define( 'AWEF_NAME', 'Footnotes' );
  • awesome-footnotes/tags/3.9.3/classes/controllers/class-footnotes-formatter.php

    r3366051 r3433059  
    4242         * @since 3.0.0
    4343         */
    44         public static $pos = 0;
     44        public static int $pos = 0;
    4545
    4646        /**
     
    5151         * @since 3.4.0
    5252         */
    53         public static $current_post = 0;
     53        public static int $current_post = 0;
    5454
    5555        /**
     
    6060         * @since 3.3.3
    6161         */
    62         public static $block_starting_pos = -1;
     62        public static int $block_starting_pos = -1;
    6363
    6464        /**
     
    6969         * @since 2.0.0
    7070         */
    71         private static $styles = array(
     71        private static array $styles = array(
    7272            'decimal'              => '1,2...10',
    7373            'decimal-leading-zero' => '01, 02...10',
     
    8686         * @since 2.4.0
    8787         */
    88         private static $identifiers = array();
     88        private static array $identifiers = array();
    8989
    9090        /**
     
    9595         * @since 2.0.0
    9696         */
    97         public static function init() {
     97        public static function init(): void {
    9898
    9999            /**
     
    156156         * @since 2.4.0
    157157         */
    158         public static function show_footnotes( $args = null ) {
     158        public static function show_footnotes( $args = null ): string {
    159159            global $post, $wp_current_filter;
    160160
     
    199199         * @since 2.0.0
    200200         */
    201         public static function insert_styles( $post_id = null ) {
     201        public static function insert_styles( ?int $post_id = null ): void {
    202202            if ( null === $post_id ) {
    203203                $post_id = 0;
     
    222222         * @since 2.0.0
    223223         */
    224         public static function register_script() {
     224        public static function register_script(): void {
    225225            if ( Settings::get_current_options()['pretty_tooltips'] ) {
    226226                \wp_register_script(
     
    264264         * @since 2.0.0
    265265         */
    266         public static function print_script() {
     266        public static function print_script(): void {
    267267            if ( Settings::get_current_options()['pretty_tooltips'] ) {
    268268                \wp_print_scripts( 'wp-footnotes-tooltips' );
     
    300300         * @since 2.0.0
    301301         */
    302         public static function process( $data ) {
     302        public static function process( $data ): string {
    303303
    304304            global $post, $wp_current_filter;
     
    433433            foreach ( $identifiers as $key => $identifier ) {
    434434
    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 );
    438438
    439439                $id_href    = ( ( $use_full_link ) ? \get_permalink( $inner_post->ID ) : '' ) . '#footnote_' . ( $identifier['use_footnote'] + $start_number ) . '_' . $inner_post->ID;
     
    675675                $footnotes_block .= '>';
    676676                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> ';
    678678                }
    679679                $footnotes_block .= ( ( $before_position ) ? $foot_links : '' );
     
    732732         * @since 3.7.0
    733733         */
    734         public static function get_template( string $subfolder, string $file ) {
     734        public static function get_template( string $subfolder, string $file ): void {
    735735            $real_file = $file . '.php';
    736736
     
    763763         * @since 2.0.0
    764764         */
    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
    766771            // Check if this post is using a different list style to the settings.
    767772            if ( \get_post_meta( $post->ID, 'footnote_style', true ) && array_key_exists( \get_post_meta( $post->ID, 'footnote_style', true ), self::$styles ) ) {
     
    771776            }
    772777
    773             return $style;
     778            return (string) $style;
    774779        }
    775780
     
    858863         * @since 2.3.0
    859864         */
    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 {
    861866            $start_string = mb_substr( $original, 0, $position, 'UTF-8' );
    862867            $end_string   = mb_substr( $original, $position + $length, mb_strlen( $original ), 'UTF-8' );
     
    872877         * Convert number to a specific style
    873878         *
    874          * @param string $num      The number to be converted.
     879         * @param int    $num      The number to be converted.
    875880         * @param string $style    The style of output required.
    876          * @param string $total    The total length.
     881         * @param int    $total    The total length.
    877882         *
    878883         * @return string  The converted number
     
    880885         * @since 2.0.0
    881886         */
    882         public static function convert_num( $num, $style, $total ) {
     887        public static function convert_num( int $num, string $style, int $total ): string {
    883888
    884889            switch ( $style ) {
     
    904909                    return $sym;
    905910                default:
    906                     return $num;
     911                    return (string) $num;
    907912            }
    908913        }
     
    920925         * @since 2.0.0
    921926         */
    922         public static function roman( $num, $letter_case = 'upper' ) {
     927        public static function roman( int $num, string $letter_case = 'upper' ): string {
    923928
    924929            $num = (int) $num;
     
    959964         * @since 2.0.0
    960965         */
    961         public static function alpha( $num, $target_case = 'upper' ) {
     966        public static function alpha( int $num, string $target_case = 'upper' ): string {
    962967            $num = (int) $num;
    963968
     
    973978                ++$j;
    974979            }
     980
     981            return '';
    975982        }
    976983
     
    9931000         * @since 3.8.1
    9941001         */
    995         public static function clear_vars() {
     1002        public static function clear_vars(): void {
    9961003            self::$pos                = 0;
    9971004            self::$block_starting_pos = -1;
  • awesome-footnotes/tags/3.9.3/readme.txt

    r3429715 r3433059  
    44Tested up to: 6.9
    55Requires PHP: 7.4
    6 Stable tag: 3.9.2
     6Stable tag: 3.9.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    189189== Change Log ==
    190190
     191= 3.9.3 =
     192Added more strict typification in the formatter class.
     193
    191194= 3.9.2 =
    192195Extended 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  
    1313 * Plugin Name:     Footnotes
    1414 * Description:     Allows post authors to easily add and manage footnotes in posts.
    15  * Version:         3.9.2
     15 * Version:         3.9.3
    1616 * Author:          Footnotes
    1717 * Author URI:      https://quotecites.com
     
    2929}
    3030
    31 define( 'AWEF_VERSION', '3.9.2' );
     31define( 'AWEF_VERSION', '3.9.3' );
    3232define( 'AWEF_TEXTDOMAIN', 'awesome-footnotes' );
    3333define( 'AWEF_NAME', 'Footnotes' );
  • awesome-footnotes/trunk/classes/controllers/class-footnotes-formatter.php

    r3366051 r3433059  
    4242         * @since 3.0.0
    4343         */
    44         public static $pos = 0;
     44        public static int $pos = 0;
    4545
    4646        /**
     
    5151         * @since 3.4.0
    5252         */
    53         public static $current_post = 0;
     53        public static int $current_post = 0;
    5454
    5555        /**
     
    6060         * @since 3.3.3
    6161         */
    62         public static $block_starting_pos = -1;
     62        public static int $block_starting_pos = -1;
    6363
    6464        /**
     
    6969         * @since 2.0.0
    7070         */
    71         private static $styles = array(
     71        private static array $styles = array(
    7272            'decimal'              => '1,2...10',
    7373            'decimal-leading-zero' => '01, 02...10',
     
    8686         * @since 2.4.0
    8787         */
    88         private static $identifiers = array();
     88        private static array $identifiers = array();
    8989
    9090        /**
     
    9595         * @since 2.0.0
    9696         */
    97         public static function init() {
     97        public static function init(): void {
    9898
    9999            /**
     
    156156         * @since 2.4.0
    157157         */
    158         public static function show_footnotes( $args = null ) {
     158        public static function show_footnotes( $args = null ): string {
    159159            global $post, $wp_current_filter;
    160160
     
    199199         * @since 2.0.0
    200200         */
    201         public static function insert_styles( $post_id = null ) {
     201        public static function insert_styles( ?int $post_id = null ): void {
    202202            if ( null === $post_id ) {
    203203                $post_id = 0;
     
    222222         * @since 2.0.0
    223223         */
    224         public static function register_script() {
     224        public static function register_script(): void {
    225225            if ( Settings::get_current_options()['pretty_tooltips'] ) {
    226226                \wp_register_script(
     
    264264         * @since 2.0.0
    265265         */
    266         public static function print_script() {
     266        public static function print_script(): void {
    267267            if ( Settings::get_current_options()['pretty_tooltips'] ) {
    268268                \wp_print_scripts( 'wp-footnotes-tooltips' );
     
    300300         * @since 2.0.0
    301301         */
    302         public static function process( $data ) {
     302        public static function process( $data ): string {
    303303
    304304            global $post, $wp_current_filter;
     
    433433            foreach ( $identifiers as $key => $identifier ) {
    434434
    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 );
    438438
    439439                $id_href    = ( ( $use_full_link ) ? \get_permalink( $inner_post->ID ) : '' ) . '#footnote_' . ( $identifier['use_footnote'] + $start_number ) . '_' . $inner_post->ID;
     
    675675                $footnotes_block .= '>';
    676676                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> ';
    678678                }
    679679                $footnotes_block .= ( ( $before_position ) ? $foot_links : '' );
     
    732732         * @since 3.7.0
    733733         */
    734         public static function get_template( string $subfolder, string $file ) {
     734        public static function get_template( string $subfolder, string $file ): void {
    735735            $real_file = $file . '.php';
    736736
     
    763763         * @since 2.0.0
    764764         */
    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
    766771            // Check if this post is using a different list style to the settings.
    767772            if ( \get_post_meta( $post->ID, 'footnote_style', true ) && array_key_exists( \get_post_meta( $post->ID, 'footnote_style', true ), self::$styles ) ) {
     
    771776            }
    772777
    773             return $style;
     778            return (string) $style;
    774779        }
    775780
     
    858863         * @since 2.3.0
    859864         */
    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 {
    861866            $start_string = mb_substr( $original, 0, $position, 'UTF-8' );
    862867            $end_string   = mb_substr( $original, $position + $length, mb_strlen( $original ), 'UTF-8' );
     
    872877         * Convert number to a specific style
    873878         *
    874          * @param string $num      The number to be converted.
     879         * @param int    $num      The number to be converted.
    875880         * @param string $style    The style of output required.
    876          * @param string $total    The total length.
     881         * @param int    $total    The total length.
    877882         *
    878883         * @return string  The converted number
     
    880885         * @since 2.0.0
    881886         */
    882         public static function convert_num( $num, $style, $total ) {
     887        public static function convert_num( int $num, string $style, int $total ): string {
    883888
    884889            switch ( $style ) {
     
    904909                    return $sym;
    905910                default:
    906                     return $num;
     911                    return (string) $num;
    907912            }
    908913        }
     
    920925         * @since 2.0.0
    921926         */
    922         public static function roman( $num, $letter_case = 'upper' ) {
     927        public static function roman( int $num, string $letter_case = 'upper' ): string {
    923928
    924929            $num = (int) $num;
     
    959964         * @since 2.0.0
    960965         */
    961         public static function alpha( $num, $target_case = 'upper' ) {
     966        public static function alpha( int $num, string $target_case = 'upper' ): string {
    962967            $num = (int) $num;
    963968
     
    973978                ++$j;
    974979            }
     980
     981            return '';
    975982        }
    976983
     
    9931000         * @since 3.8.1
    9941001         */
    995         public static function clear_vars() {
     1002        public static function clear_vars(): void {
    9961003            self::$pos                = 0;
    9971004            self::$block_starting_pos = -1;
  • awesome-footnotes/trunk/readme.txt

    r3429715 r3433059  
    44Tested up to: 6.9
    55Requires PHP: 7.4
    6 Stable tag: 3.9.2
     6Stable tag: 3.9.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    189189== Change Log ==
    190190
     191= 3.9.3 =
     192Added more strict typification in the formatter class.
     193
    191194= 3.9.2 =
    192195Extended 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.