Plugin Directory

Changeset 3375111


Ignore:
Timestamp:
10/08/2025 12:58:54 PM (6 months ago)
Author:
DannyCooper
Message:

Update to version 3.7.1 from GitHub

Location:
disable-remove-google-fonts
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • disable-remove-google-fonts/tags/3.7.1/admin/class-drgf-admin.php

    r3018723 r3375111  
    3030     */
    3131    function admin_redirect() {
     32        // Check user capabilities.
     33        if ( ! current_user_can( 'manage_options' ) ) {
     34            return;
     35        }
     36
    3237        if ( get_option( 'drgf_do_activation_redirect', false ) ) {
    3338            delete_option( 'drgf_do_activation_redirect' );
    3439            if ( ! isset( $_GET['activate-multi'] ) && ! is_network_admin() ) {
    35                 wp_redirect( admin_url('themes.php?page=drgf') );
     40                wp_safe_redirect( admin_url( 'themes.php?page=drgf' ) );
    3641                exit;
    3742            }
     
    8893                        <p>This plugin completely removes all references to Google Fonts from your website. That means that your website will no longer render  Google Fonts and will instead revert to a <a target="_blank" href="https://fontsplugin.com/web-safe-system-fonts/">fallback font</a>.</p>
    8994                        <p>However, some services load Google Fonts within an embedded iFrame. These include YouTube, Google Maps and ReCaptcha. It's not possible for this plugin to remove those services for the reasons <a target="_blank" href="https://fontsplugin.com/remove-disable-google-fonts/#youtube">outlined here</a>.</p>
    90                         <?php if ( function_exists( 'ogf_initiate' ) ) : ?>
    91                             <h3>⭐️ Fonts Plugin Pro</h3>
    92                             <p>Instead of removing the fonts completely, <a target="_blank" href="https://fontsplugin.com/drgf-upgrade">Fonts Plugin Pro</a> enables you to host the fonts from your <strong>own domain</strong> (<?php echo $url; ?>)  with the click of a button. Locally hosted fonts are more efficient, quicker to load and don't connect to any third-parties (GDPR & DSGVO-friendly).</p>
    93                             <a class="drgf-admin__button button" href="https://fontsplugin.com/drgf-upgrade" target="_blank">Learn More</a>
    94                         <?php else : ?>
    95                             <h3>⭐️ Host Google Fonts Locally</h3>
    96                             <p>Instead of removing the fonts completely, our <a href="https://fontsplugin.com/drgf-upgrade" target="_blank">Pro upgrade</a> enables you to host the fonts from your <strong>own domain</strong> (<?php echo $url; ?>)  with the click of a button. Locally hosted fonts are more efficient, quicker to load and don't connect to any third-parties (GDPR & DSGVO-friendly).</p>
    97                             <a class="drgf-admin__button button" href="https://fontsplugin.com/drgf-upgrade" target="_blank">Get Started</a>
    98                         <?php endif; ?>
     95                    <?php if ( function_exists( 'ogf_initiate' ) ) : ?>
     96                        <h3>⭐️ Fonts Plugin Pro</h3>
     97                        <p>Instead of removing the fonts completely, <a target="_blank" href="https://fontsplugin.com/drgf-upgrade">Fonts Plugin Pro</a> enables you to host the fonts from your <strong>own domain</strong> (<?php echo esc_html( $url ); ?>)  with the click of a button. Locally hosted fonts are more efficient, quicker to load and don't connect to any third-parties (GDPR & DSGVO-friendly).</p>
     98                        <a class="drgf-admin__button button" href="https://fontsplugin.com/drgf-upgrade" target="_blank">Learn More</a>
     99                    <?php else : ?>
     100                        <h3>⭐️ Host Google Fonts Locally</h3>
     101                        <p>Instead of removing the fonts completely, our <a href="https://fontsplugin.com/drgf-upgrade" target="_blank">Pro upgrade</a> enables you to host the fonts from your <strong>own domain</strong> (<?php echo esc_html( $url ); ?>)  with the click of a button. Locally hosted fonts are more efficient, quicker to load and don't connect to any third-parties (GDPR & DSGVO-friendly).</p>
     102                        <a class="drgf-admin__button button" href="https://fontsplugin.com/drgf-upgrade" target="_blank">Get Started</a>
     103                    <?php endif; ?>
    99104                    </div>
    100105                </div>
  • disable-remove-google-fonts/tags/3.7.1/admin/class-drgf-notice.php

    r2823523 r3375111  
    5353        }
    5454
    55         /**
    56          * Enqeue the styles and scripts.
    57          */
    58         public function enqueue() {
    59             wp_enqueue_script( 'drgf-scripts', esc_url( DRGF_DIR_URL . 'admin/scripts.js' ), array( 'jquery' ), DRGF_VERSION, false );
     55    /**
     56     * Enqeue the styles and scripts.
     57     */
     58    public function enqueue() {
     59        wp_enqueue_script( 'drgf-scripts', esc_url( DRGF_DIR_URL . 'admin/scripts.js' ), array( 'jquery' ), DRGF_VERSION, false );
     60        wp_localize_script(
     61            'drgf-scripts',
     62            'drgfNotice',
     63            array(
     64                'nonce' => wp_create_nonce( 'drgf_dismiss_notice' ),
     65            )
     66        );
     67    }
     68
     69    /**
     70     * AJAX handler to store the state of dismissible notices.
     71     */
     72    public function dismiss_notice() {
     73        // Verify nonce.
     74        if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'drgf_dismiss_notice' ) ) {
     75            wp_die( esc_html__( 'Security check failed.', 'disable-remove-google-fonts' ) );
    6076        }
    6177
    62         /**
    63          * AJAX handler to store the state of dismissible notices.
    64          */
    65         public function dismiss_notice() {
    66             if ( isset( $_POST['type'] ) ) {
    67                 // Pick up the notice "type" - passed via jQuery (the "data-notice" attribute on the notice).
    68                 $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
    69                 // Store it in the options table.
    70                 update_option( 'dismissed-' . $type, true );
    71             }
     78        // Check user capabilities.
     79        if ( ! current_user_can( 'manage_options' ) ) {
     80            wp_die( esc_html__( 'You do not have permission to perform this action.', 'disable-remove-google-fonts' ) );
    7281        }
     82
     83        if ( isset( $_POST['type'] ) ) {
     84            // Pick up the notice "type" - passed via jQuery (the "data-notice" attribute on the notice).
     85            $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
     86            // Store it in the options table.
     87            update_option( 'dismissed-' . $type, true );
     88        }
     89    }
    7390
    7491        /**
     
    8198            ?>
    8299
    83             <div class="notice notice-<?php echo esc_attr( $this->type ); ?> is-dismissible notice-dismiss-drgf" data-notice="<?php echo esc_attr( $this->slug ); ?>">
    84                 <p>
    85                     <?php
    86                         echo $this->message; // WPCS: XSS ok.
    87                     ?>
    88                 </p>
    89             </div>
     100        <div class="notice notice-<?php echo esc_attr( $this->type ); ?> is-dismissible notice-dismiss-drgf" data-notice="<?php echo esc_attr( $this->slug ); ?>">
     101            <p>
     102                <?php
     103                    echo wp_kses_post( $this->message );
     104                ?>
     105            </p>
     106        </div>
    90107            <?php
    91108        }
  • disable-remove-google-fonts/tags/3.7.1/admin/scripts.js

    r2821507 r3375111  
    1 /* global ajaxurl */
     1/* global ajaxurl, drgfNotice */
    22jQuery( document ).ready( function() {
    33
     
    2020                        action: 'drgf_dismiss_notice',
    2121                        type: type,
     22                        nonce: drgfNotice.nonce,
    2223                    },
    2324                }
  • disable-remove-google-fonts/tags/3.7.1/changelog.txt

    r3325513 r3375111  
     1= 1.7.1 =
     2
     3* Tested with WP6.8
     4
    15= 1.7.0 =
    26
  • disable-remove-google-fonts/tags/3.7.1/disable-remove-google-fonts.php

    r3325513 r3375111  
    66 * Author: Fonts Plugin
    77 * Author URI: https://fontsplugin.com
    8  * Version: 1.7.0
     8 * Version: 1.7.1
    99 * License: GPLv2 or later
    1010 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
     
    3232
    3333if ( ! defined( 'DRGF_VERSION' ) ) {
    34     define( 'DRGF_VERSION', '1.7.0' );
     34    define( 'DRGF_VERSION', '1.7.1' );
    3535}
    3636
  • disable-remove-google-fonts/tags/3.7.1/inc/remove-google-fonts.php

    r3325513 r3375111  
    4141 * Dequeue Google Fonts based on URL.
    4242 */
    43 function drgf_dequeueu_fonts() {
     43function drgf_dequeue_fonts() {
    4444    // Remove fonts added by the Divi Extra theme.
    4545    remove_action( 'wp_footer', 'et_builder_print_font' );
     
    109109}
    110110
    111 add_action( 'wp_enqueue_scripts', 'drgf_dequeueu_fonts', PHP_INT_MAX );
    112 add_action( 'wp_print_styles', 'drgf_dequeueu_fonts', PHP_INT_MAX );
     111add_action( 'wp_enqueue_scripts', 'drgf_dequeue_fonts', PHP_INT_MAX );
     112add_action( 'wp_print_styles', 'drgf_dequeue_fonts', PHP_INT_MAX );
    113113
    114114/**
     
    202202 * Dequeue Google Fonts loaded by Avada theme.
    203203 */
    204 $fusion_options = get_option( 'fusion_options', false );
    205 if (
    206         $fusion_options
    207         && isset( $fusion_options['gfonts_load_method'] )
    208         && $fusion_options['gfonts_load_method'] === 'cdn'
    209     ) {
    210     add_filter(
    211         'fusion_google_fonts',
    212         function ( $fonts ) {
    213             return array();
    214         },
    215         99999
    216     );
     204if ( class_exists( 'Avada' ) || function_exists( 'fusion_reset_all_caches' ) ) {
     205    $fusion_options = get_option( 'fusion_options', false );
     206    if (
     207            $fusion_options
     208            && isset( $fusion_options['gfonts_load_method'] )
     209            && $fusion_options['gfonts_load_method'] === 'cdn'
     210        ) {
     211        add_filter(
     212            'fusion_google_fonts',
     213            function ( $fonts ) {
     214                return array();
     215            },
     216            99999
     217        );
     218    }
    217219}
    218220
     
    277279 */
    278280function drgf_strposa( $haystack, $needles, $offset = 0 ) {
    279     $chr = array();
    280281    foreach ( $needles as $needle ) {
    281282        $res = strpos( $haystack, $needle, $offset );
     
    341342);
    342343
    343 add_action( 'plugins_loaded', 'dgrf_after_plugins_loaded', 9999 );
     344add_action( 'plugins_loaded', 'drgf_after_plugins_loaded', 9999 );
    344345
    345346/**
    346347 * Run this code after all plugins have been loaded.
    347348 */
    348 function dgrf_after_plugins_loaded() {
     349function drgf_after_plugins_loaded() {
    349350    /**
    350351     * Dequeue Google Fonts loaded by the GroovyMenu plugin.
  • disable-remove-google-fonts/tags/3.7.1/readme.txt

    r3325513 r3375111  
    33Tags: gdpr, dsgvo, google fonts, disable google fonts, optimize
    44Requires at least: 4.8
    5 Tested up to: 6.7
     5Tested up to: 6.8
    66License: GPLv2 or later
    77Stable tag: trunk
  • disable-remove-google-fonts/trunk/admin/class-drgf-admin.php

    r3018723 r3375111  
    3030     */
    3131    function admin_redirect() {
     32        // Check user capabilities.
     33        if ( ! current_user_can( 'manage_options' ) ) {
     34            return;
     35        }
     36
    3237        if ( get_option( 'drgf_do_activation_redirect', false ) ) {
    3338            delete_option( 'drgf_do_activation_redirect' );
    3439            if ( ! isset( $_GET['activate-multi'] ) && ! is_network_admin() ) {
    35                 wp_redirect( admin_url('themes.php?page=drgf') );
     40                wp_safe_redirect( admin_url( 'themes.php?page=drgf' ) );
    3641                exit;
    3742            }
     
    8893                        <p>This plugin completely removes all references to Google Fonts from your website. That means that your website will no longer render  Google Fonts and will instead revert to a <a target="_blank" href="https://fontsplugin.com/web-safe-system-fonts/">fallback font</a>.</p>
    8994                        <p>However, some services load Google Fonts within an embedded iFrame. These include YouTube, Google Maps and ReCaptcha. It's not possible for this plugin to remove those services for the reasons <a target="_blank" href="https://fontsplugin.com/remove-disable-google-fonts/#youtube">outlined here</a>.</p>
    90                         <?php if ( function_exists( 'ogf_initiate' ) ) : ?>
    91                             <h3>⭐️ Fonts Plugin Pro</h3>
    92                             <p>Instead of removing the fonts completely, <a target="_blank" href="https://fontsplugin.com/drgf-upgrade">Fonts Plugin Pro</a> enables you to host the fonts from your <strong>own domain</strong> (<?php echo $url; ?>)  with the click of a button. Locally hosted fonts are more efficient, quicker to load and don't connect to any third-parties (GDPR & DSGVO-friendly).</p>
    93                             <a class="drgf-admin__button button" href="https://fontsplugin.com/drgf-upgrade" target="_blank">Learn More</a>
    94                         <?php else : ?>
    95                             <h3>⭐️ Host Google Fonts Locally</h3>
    96                             <p>Instead of removing the fonts completely, our <a href="https://fontsplugin.com/drgf-upgrade" target="_blank">Pro upgrade</a> enables you to host the fonts from your <strong>own domain</strong> (<?php echo $url; ?>)  with the click of a button. Locally hosted fonts are more efficient, quicker to load and don't connect to any third-parties (GDPR & DSGVO-friendly).</p>
    97                             <a class="drgf-admin__button button" href="https://fontsplugin.com/drgf-upgrade" target="_blank">Get Started</a>
    98                         <?php endif; ?>
     95                    <?php if ( function_exists( 'ogf_initiate' ) ) : ?>
     96                        <h3>⭐️ Fonts Plugin Pro</h3>
     97                        <p>Instead of removing the fonts completely, <a target="_blank" href="https://fontsplugin.com/drgf-upgrade">Fonts Plugin Pro</a> enables you to host the fonts from your <strong>own domain</strong> (<?php echo esc_html( $url ); ?>)  with the click of a button. Locally hosted fonts are more efficient, quicker to load and don't connect to any third-parties (GDPR & DSGVO-friendly).</p>
     98                        <a class="drgf-admin__button button" href="https://fontsplugin.com/drgf-upgrade" target="_blank">Learn More</a>
     99                    <?php else : ?>
     100                        <h3>⭐️ Host Google Fonts Locally</h3>
     101                        <p>Instead of removing the fonts completely, our <a href="https://fontsplugin.com/drgf-upgrade" target="_blank">Pro upgrade</a> enables you to host the fonts from your <strong>own domain</strong> (<?php echo esc_html( $url ); ?>)  with the click of a button. Locally hosted fonts are more efficient, quicker to load and don't connect to any third-parties (GDPR & DSGVO-friendly).</p>
     102                        <a class="drgf-admin__button button" href="https://fontsplugin.com/drgf-upgrade" target="_blank">Get Started</a>
     103                    <?php endif; ?>
    99104                    </div>
    100105                </div>
  • disable-remove-google-fonts/trunk/admin/class-drgf-notice.php

    r2823523 r3375111  
    5353        }
    5454
    55         /**
    56          * Enqeue the styles and scripts.
    57          */
    58         public function enqueue() {
    59             wp_enqueue_script( 'drgf-scripts', esc_url( DRGF_DIR_URL . 'admin/scripts.js' ), array( 'jquery' ), DRGF_VERSION, false );
     55    /**
     56     * Enqeue the styles and scripts.
     57     */
     58    public function enqueue() {
     59        wp_enqueue_script( 'drgf-scripts', esc_url( DRGF_DIR_URL . 'admin/scripts.js' ), array( 'jquery' ), DRGF_VERSION, false );
     60        wp_localize_script(
     61            'drgf-scripts',
     62            'drgfNotice',
     63            array(
     64                'nonce' => wp_create_nonce( 'drgf_dismiss_notice' ),
     65            )
     66        );
     67    }
     68
     69    /**
     70     * AJAX handler to store the state of dismissible notices.
     71     */
     72    public function dismiss_notice() {
     73        // Verify nonce.
     74        if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'drgf_dismiss_notice' ) ) {
     75            wp_die( esc_html__( 'Security check failed.', 'disable-remove-google-fonts' ) );
    6076        }
    6177
    62         /**
    63          * AJAX handler to store the state of dismissible notices.
    64          */
    65         public function dismiss_notice() {
    66             if ( isset( $_POST['type'] ) ) {
    67                 // Pick up the notice "type" - passed via jQuery (the "data-notice" attribute on the notice).
    68                 $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
    69                 // Store it in the options table.
    70                 update_option( 'dismissed-' . $type, true );
    71             }
     78        // Check user capabilities.
     79        if ( ! current_user_can( 'manage_options' ) ) {
     80            wp_die( esc_html__( 'You do not have permission to perform this action.', 'disable-remove-google-fonts' ) );
    7281        }
     82
     83        if ( isset( $_POST['type'] ) ) {
     84            // Pick up the notice "type" - passed via jQuery (the "data-notice" attribute on the notice).
     85            $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
     86            // Store it in the options table.
     87            update_option( 'dismissed-' . $type, true );
     88        }
     89    }
    7390
    7491        /**
     
    8198            ?>
    8299
    83             <div class="notice notice-<?php echo esc_attr( $this->type ); ?> is-dismissible notice-dismiss-drgf" data-notice="<?php echo esc_attr( $this->slug ); ?>">
    84                 <p>
    85                     <?php
    86                         echo $this->message; // WPCS: XSS ok.
    87                     ?>
    88                 </p>
    89             </div>
     100        <div class="notice notice-<?php echo esc_attr( $this->type ); ?> is-dismissible notice-dismiss-drgf" data-notice="<?php echo esc_attr( $this->slug ); ?>">
     101            <p>
     102                <?php
     103                    echo wp_kses_post( $this->message );
     104                ?>
     105            </p>
     106        </div>
    90107            <?php
    91108        }
  • disable-remove-google-fonts/trunk/admin/scripts.js

    r2821507 r3375111  
    1 /* global ajaxurl */
     1/* global ajaxurl, drgfNotice */
    22jQuery( document ).ready( function() {
    33
     
    2020                        action: 'drgf_dismiss_notice',
    2121                        type: type,
     22                        nonce: drgfNotice.nonce,
    2223                    },
    2324                }
  • disable-remove-google-fonts/trunk/changelog.txt

    r3325513 r3375111  
     1= 1.7.1 =
     2
     3* Tested with WP6.8
     4
    15= 1.7.0 =
    26
  • disable-remove-google-fonts/trunk/disable-remove-google-fonts.php

    r3325513 r3375111  
    66 * Author: Fonts Plugin
    77 * Author URI: https://fontsplugin.com
    8  * Version: 1.7.0
     8 * Version: 1.7.1
    99 * License: GPLv2 or later
    1010 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
     
    3232
    3333if ( ! defined( 'DRGF_VERSION' ) ) {
    34     define( 'DRGF_VERSION', '1.7.0' );
     34    define( 'DRGF_VERSION', '1.7.1' );
    3535}
    3636
  • disable-remove-google-fonts/trunk/inc/remove-google-fonts.php

    r3325513 r3375111  
    4141 * Dequeue Google Fonts based on URL.
    4242 */
    43 function drgf_dequeueu_fonts() {
     43function drgf_dequeue_fonts() {
    4444    // Remove fonts added by the Divi Extra theme.
    4545    remove_action( 'wp_footer', 'et_builder_print_font' );
     
    109109}
    110110
    111 add_action( 'wp_enqueue_scripts', 'drgf_dequeueu_fonts', PHP_INT_MAX );
    112 add_action( 'wp_print_styles', 'drgf_dequeueu_fonts', PHP_INT_MAX );
     111add_action( 'wp_enqueue_scripts', 'drgf_dequeue_fonts', PHP_INT_MAX );
     112add_action( 'wp_print_styles', 'drgf_dequeue_fonts', PHP_INT_MAX );
    113113
    114114/**
     
    202202 * Dequeue Google Fonts loaded by Avada theme.
    203203 */
    204 $fusion_options = get_option( 'fusion_options', false );
    205 if (
    206         $fusion_options
    207         && isset( $fusion_options['gfonts_load_method'] )
    208         && $fusion_options['gfonts_load_method'] === 'cdn'
    209     ) {
    210     add_filter(
    211         'fusion_google_fonts',
    212         function ( $fonts ) {
    213             return array();
    214         },
    215         99999
    216     );
     204if ( class_exists( 'Avada' ) || function_exists( 'fusion_reset_all_caches' ) ) {
     205    $fusion_options = get_option( 'fusion_options', false );
     206    if (
     207            $fusion_options
     208            && isset( $fusion_options['gfonts_load_method'] )
     209            && $fusion_options['gfonts_load_method'] === 'cdn'
     210        ) {
     211        add_filter(
     212            'fusion_google_fonts',
     213            function ( $fonts ) {
     214                return array();
     215            },
     216            99999
     217        );
     218    }
    217219}
    218220
     
    277279 */
    278280function drgf_strposa( $haystack, $needles, $offset = 0 ) {
    279     $chr = array();
    280281    foreach ( $needles as $needle ) {
    281282        $res = strpos( $haystack, $needle, $offset );
     
    341342);
    342343
    343 add_action( 'plugins_loaded', 'dgrf_after_plugins_loaded', 9999 );
     344add_action( 'plugins_loaded', 'drgf_after_plugins_loaded', 9999 );
    344345
    345346/**
    346347 * Run this code after all plugins have been loaded.
    347348 */
    348 function dgrf_after_plugins_loaded() {
     349function drgf_after_plugins_loaded() {
    349350    /**
    350351     * Dequeue Google Fonts loaded by the GroovyMenu plugin.
  • disable-remove-google-fonts/trunk/readme.txt

    r3325513 r3375111  
    33Tags: gdpr, dsgvo, google fonts, disable google fonts, optimize
    44Requires at least: 4.8
    5 Tested up to: 6.7
     5Tested up to: 6.8
    66License: GPLv2 or later
    77Stable tag: trunk
Note: See TracChangeset for help on using the changeset viewer.