Plugin Directory

Changeset 3024987


Ignore:
Timestamp:
01/22/2024 09:12:23 AM (2 years ago)
Author:
sdobreff
Message:

code changes before v.2.5.0

Location:
footnotes-made-easy/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • footnotes-made-easy/trunk/classes/class-footnotes-made-easy.php

    r3019096 r3024987  
    44 *
    55 * @package    fme
    6  * @copyright  2024 Footnotes
     6 * @copyright  %%YEAR%% Footnotes
    77 * @license    https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
    88 * @link       https://wordpress.org/plugins/footnotes-made-easy/
  • footnotes-made-easy/trunk/classes/controllers/class-footnotes-formatter.php

    r3017293 r3024987  
    271271
    272272            $filters = (array) $wp_current_filter;
     273
     274            $excerpt_call = false;
    273275            // Lets check filters, and if that call comes from excerpt function, we have to remove ourselves.
    274276            foreach ( $filters as $filter ) {
    275277                if ( false !== \strpos( $filter, 'excerpt' ) ) {
    276                     $display = false;
     278                    $display      = false;
     279                    $excerpt_call = true;
    277280
    278281                    break;
     
    294297                $data = \str_replace( self::SHORT_CODE_POSITION_HOLDER, '', $data );
    295298
     299                if ( $excerpt_call ) {
     300                    if ( isset( self::$identifiers[ $post->ID ] ) ) {
     301                        unset( self::$identifiers[ $post->ID ] );
     302                    }
     303                }
     304
    296305                return $data;
    297306            }
     
    300309            $start_number = ( 1 === preg_match( '|<!\-\-startnum=(\d+)\-\->|', $data, $start_number_array ) ) ? $start_number_array[1] : 1;
    301310
    302             // // Regex extraction of all footnotes (or return if there are none).
    303             // if ( ! preg_match_all( '/(' . preg_quote( Settings::get_current_options()['footnotes_open'], '/' ) . ')(.*)(' . preg_quote( Settings::get_current_options()['footnotes_close'], '/' ) . ')/Us', $data, $identifiers, PREG_SET_ORDER ) ) {
    304             // return $data;
    305             // }
    306 
    307             $processed_data = self::get_footnotes( $data, $post->ID );
    308 
    309             $footnotes = $processed_data['footnotes'];
    310             $identifiers = $processed_data['identifiers'];
     311            $processed_data = self::get_footnotes( $data, $post->ID );
     312
     313            $footnotes   = $processed_data['footnotes'];
     314            $identifiers = $processed_data['identifiers'];
    311315
    312316            $style = self::get_style( $post );
     
    436440            }
    437441
    438             return ['footnotes'=>$footnotes,'identifiers'=>$identifiers];
     442            return array(
     443                'footnotes'   => $footnotes,
     444                'identifiers' => $identifiers,
     445            );
    439446        }
    440447
     
    517524                        }
    518525
    519                         $footnotes_markup = $footnotes_markup . Settings::get_current_options()['pre_backlink'] . '<a href="' . ( ( $use_full_link ) ? get_permalink( $post->ID ) : '' ) . '#identifier_' . $identifier . '_' . $post->ID . '" class="footnote-link footnote-back-link" title="' . $back_link_title_footnote . '" aria-label="' . $back_link_title . '">' . Settings::get_current_options()['backlink'] . '</a>' . Settings::get_current_options()['post_backlink'];
     526                        $footnotes_markup = $footnotes_markup . '<span class="fme-pre-backlink">' . Settings::get_current_options()['pre_backlink'] . '</span><a href="' . ( ( $use_full_link ) ? get_permalink( $post->ID ) : '' ) . '#identifier_' . $identifier . '_' . $post->ID . '" class="footnote-link footnote-back-link" title="' . $back_link_title_footnote . '" aria-label="' . $back_link_title . '">' . Settings::get_current_options()['backlink'] . '</a><span class="fme-pre-backlink">' . Settings::get_current_options()['post_backlink'] . '</span>';
    520527                    }
    521528                    $footnotes_markup .= '</span>';
     
    525532            $footnotes_markup .= '</ol>';
    526533
    527             if ( ! empty( $footnotes_footer = Settings::get_current_options()['post_footnotes'] ) ) { // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure
     534            if ( ! empty( $footnotes_footer = Settings::get_current_options()['post_footnotes'] ) ) { // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure, Generic.CodeAnalysis.AssignmentInCondition.Found
    528535                if ( ! Settings::get_current_options()['no_tags_header_footer'] ) {
    529536                    $footnotes_footer =
  • footnotes-made-easy/trunk/classes/helpers/class-settings.php

    r3016317 r3024987  
    2929    class Settings {
    3030
    31         public const OPTIONS_VERSION = '8'; // Incremented when the options array changes.
     31        public const OPTIONS_VERSION = '9'; // Incremented when the options array changes.
    3232
    3333        public const MENU_SLUG = 'fme_settings';
     
    258258                self::$default_options = array(
    259259                    'superscript'             => true,
    260                     'pre_backlink'            => ' [',
     260                    'pre_backlink'            => '[',
    261261                    'backlink'                => '&#8617;',
    262262                    'post_backlink'           => ']',
     
    278278                    'combine_identical_notes' => true,
    279279                    'priority'                => 11,
    280                     'footnotes_open'          => ' ((',
     280                    'footnotes_open'          => '((',
    281281                    'footnotes_close'         => '))',
    282282                    'pretty_tooltips'         => false,
  • footnotes-made-easy/trunk/classes/migration/class-abstract-migration.php

    r3019096 r3024987  
    55 * @package    fme
    66 * @subpackage migration
    7  * @copyright  2024 Footnotes made easy
     7 * @copyright  %%YEAR%% Footnotes made easy
    88 * @license    https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
    99 */
  • footnotes-made-easy/trunk/classes/migration/class-migration.php

    r3019096 r3024987  
    55 * @package    fme
    66 * @subpackage migration
    7  * @copyright  2024
     7 * @copyright  %%YEAR%%
    88 * @license    https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
    99 */
  • footnotes-made-easy/trunk/footnotes-made-easy.php

    r3019102 r3024987  
    77 * @package   footnotes
    88 * @author    sdobreff
    9  * @copyright Copyright (C) 2023-2024, Footnotes
     9 * @copyright Copyright (C) 2023-%%YEAR%%, Footnotes
    1010 * @license   GPL v3
    1111 * @link      https://wordpress.org/plugins/footnotes-made-easy/
     
    1414 * Plugin URI:      https://github.com/sdobreff/footnotes-made-easy
    1515 * Description:     Allows post authors to easily add and manage footnotes in posts.
    16  * Version:         2.4.5
     16 * Version:         2.5.0
    1717 * Author:          Footnotes
    1818 * Author URI:      https://github.com/sdobreff
     
    3030}
    3131
    32 define( 'FME_VERSION', '2.4.5' );
     32define( 'FME_VERSION', '2.5.0' );
    3333define( 'FME_TEXTDOMAIN', 'footnotes-made-easy' );
    3434define( 'FME_NAME', 'Footnotes Made Easy' );
     
    5858                        // translators: the minimum version of the PHP required by the plugin.
    5959                        __(
    60                             '"%1$s" requires PHP %2$s or newer . ',
     60                            '"%1$s" requires PHP %2$s or newer. Plugin is automatically deactivated.',
     61                            'footnotes-made-easy'
     62                        ),
     63                        FME_NAME,
     64                        FME_MIN_PHP_VERSION
     65                    )
     66                )
     67            );
     68        }
     69    );
     70
     71    // Return early to prevent loading the plugin.
     72    return;
     73}
     74
     75if ( ! extension_loaded( 'mbstring' ) ) {
     76    add_action(
     77        'admin_init',
     78        static function () {
     79            deactivate_plugins( plugin_basename( __FILE__ ) );
     80        }
     81    );
     82    add_action(
     83        'admin_notices',
     84        static function () {
     85            echo wp_kses_post(
     86                sprintf(
     87                    '<div class="notice notice-error"><p>%s</p></div>',
     88                    sprintf(
     89                        // translators: the mbstring extensions is required by the plugin.
     90                        __(
     91                            '"%1$s" requires multi byte string extension loaded. Plugin is automatically deactivated.',
    6192                            'footnotes-made-easy'
    6293                        )
    63                     ),
    64                     FME_NAME,
    65                     FME_TEXTDOMAIN
     94                    )
    6695                )
    6796            );
  • footnotes-made-easy/trunk/readme.txt

    r3019102 r3024987  
    44Tested up to: 6.4.2
    55Requires PHP: 7.4
    6 Stable tag: 2.4.5
     6Stable tag: 2.5.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1414Footnotes Made Easy is a simple, but powerful, method of adding footnotes into your posts and pages.
    1515
    16 Key features include...
     16## Key features include...
    1717
    1818* Simple footnote insertion via markup of choice (default - double parentheses)
     
    2525* And much, much more!
    2626
    27 Technical specification...
     27### [You can try the plugin in WordPress Playground!](https://playground.wordpress.net/?plugin=footnotes-made-easy&url=%2Fwp-admin%2Fpost-new.php&wp=6.4&php-extension-bundle=kitchen-sink)
     28
     29## Technical specification...
    2830
    2931* Licensed under [GPLv2 (or later)](http://wordpress.org/about/gpl/ "GNU General Public License")
Note: See TracChangeset for help on using the changeset viewer.