Changeset 3375111
- Timestamp:
- 10/08/2025 12:58:54 PM (6 months ago)
- Location:
- disable-remove-google-fonts
- Files:
-
- 14 edited
- 1 copied
-
tags/3.7.1 (copied) (copied from disable-remove-google-fonts/trunk)
-
tags/3.7.1/admin/class-drgf-admin.php (modified) (2 diffs)
-
tags/3.7.1/admin/class-drgf-notice.php (modified) (2 diffs)
-
tags/3.7.1/admin/scripts.js (modified) (2 diffs)
-
tags/3.7.1/changelog.txt (modified) (1 diff)
-
tags/3.7.1/disable-remove-google-fonts.php (modified) (2 diffs)
-
tags/3.7.1/inc/remove-google-fonts.php (modified) (5 diffs)
-
tags/3.7.1/readme.txt (modified) (1 diff)
-
trunk/admin/class-drgf-admin.php (modified) (2 diffs)
-
trunk/admin/class-drgf-notice.php (modified) (2 diffs)
-
trunk/admin/scripts.js (modified) (2 diffs)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/disable-remove-google-fonts.php (modified) (2 diffs)
-
trunk/inc/remove-google-fonts.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
disable-remove-google-fonts/tags/3.7.1/admin/class-drgf-admin.php
r3018723 r3375111 30 30 */ 31 31 function admin_redirect() { 32 // Check user capabilities. 33 if ( ! current_user_can( 'manage_options' ) ) { 34 return; 35 } 36 32 37 if ( get_option( 'drgf_do_activation_redirect', false ) ) { 33 38 delete_option( 'drgf_do_activation_redirect' ); 34 39 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' ) ); 36 41 exit; 37 42 } … … 88 93 <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> 89 94 <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; ?> 99 104 </div> 100 105 </div> -
disable-remove-google-fonts/tags/3.7.1/admin/class-drgf-notice.php
r2823523 r3375111 53 53 } 54 54 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' ) ); 60 76 } 61 77 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' ) ); 72 81 } 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 } 73 90 74 91 /** … … 81 98 ?> 82 99 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 <?php86 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> 90 107 <?php 91 108 } -
disable-remove-google-fonts/tags/3.7.1/admin/scripts.js
r2821507 r3375111 1 /* global ajaxurl */1 /* global ajaxurl, drgfNotice */ 2 2 jQuery( document ).ready( function() { 3 3 … … 20 20 action: 'drgf_dismiss_notice', 21 21 type: type, 22 nonce: drgfNotice.nonce, 22 23 }, 23 24 } -
disable-remove-google-fonts/tags/3.7.1/changelog.txt
r3325513 r3375111 1 = 1.7.1 = 2 3 * Tested with WP6.8 4 1 5 = 1.7.0 = 2 6 -
disable-remove-google-fonts/tags/3.7.1/disable-remove-google-fonts.php
r3325513 r3375111 6 6 * Author: Fonts Plugin 7 7 * Author URI: https://fontsplugin.com 8 * Version: 1.7. 08 * Version: 1.7.1 9 9 * License: GPLv2 or later 10 10 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt … … 32 32 33 33 if ( ! defined( 'DRGF_VERSION' ) ) { 34 define( 'DRGF_VERSION', '1.7. 0' );34 define( 'DRGF_VERSION', '1.7.1' ); 35 35 } 36 36 -
disable-remove-google-fonts/tags/3.7.1/inc/remove-google-fonts.php
r3325513 r3375111 41 41 * Dequeue Google Fonts based on URL. 42 42 */ 43 function drgf_dequeue u_fonts() {43 function drgf_dequeue_fonts() { 44 44 // Remove fonts added by the Divi Extra theme. 45 45 remove_action( 'wp_footer', 'et_builder_print_font' ); … … 109 109 } 110 110 111 add_action( 'wp_enqueue_scripts', 'drgf_dequeue u_fonts', PHP_INT_MAX );112 add_action( 'wp_print_styles', 'drgf_dequeue u_fonts', PHP_INT_MAX );111 add_action( 'wp_enqueue_scripts', 'drgf_dequeue_fonts', PHP_INT_MAX ); 112 add_action( 'wp_print_styles', 'drgf_dequeue_fonts', PHP_INT_MAX ); 113 113 114 114 /** … … 202 202 * Dequeue Google Fonts loaded by Avada theme. 203 203 */ 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 ); 204 if ( 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 } 217 219 } 218 220 … … 277 279 */ 278 280 function drgf_strposa( $haystack, $needles, $offset = 0 ) { 279 $chr = array();280 281 foreach ( $needles as $needle ) { 281 282 $res = strpos( $haystack, $needle, $offset ); … … 341 342 ); 342 343 343 add_action( 'plugins_loaded', 'd grf_after_plugins_loaded', 9999 );344 add_action( 'plugins_loaded', 'drgf_after_plugins_loaded', 9999 ); 344 345 345 346 /** 346 347 * Run this code after all plugins have been loaded. 347 348 */ 348 function d grf_after_plugins_loaded() {349 function drgf_after_plugins_loaded() { 349 350 /** 350 351 * Dequeue Google Fonts loaded by the GroovyMenu plugin. -
disable-remove-google-fonts/tags/3.7.1/readme.txt
r3325513 r3375111 3 3 Tags: gdpr, dsgvo, google fonts, disable google fonts, optimize 4 4 Requires at least: 4.8 5 Tested up to: 6. 75 Tested up to: 6.8 6 6 License: GPLv2 or later 7 7 Stable tag: trunk -
disable-remove-google-fonts/trunk/admin/class-drgf-admin.php
r3018723 r3375111 30 30 */ 31 31 function admin_redirect() { 32 // Check user capabilities. 33 if ( ! current_user_can( 'manage_options' ) ) { 34 return; 35 } 36 32 37 if ( get_option( 'drgf_do_activation_redirect', false ) ) { 33 38 delete_option( 'drgf_do_activation_redirect' ); 34 39 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' ) ); 36 41 exit; 37 42 } … … 88 93 <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> 89 94 <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; ?> 99 104 </div> 100 105 </div> -
disable-remove-google-fonts/trunk/admin/class-drgf-notice.php
r2823523 r3375111 53 53 } 54 54 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' ) ); 60 76 } 61 77 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' ) ); 72 81 } 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 } 73 90 74 91 /** … … 81 98 ?> 82 99 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 <?php86 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> 90 107 <?php 91 108 } -
disable-remove-google-fonts/trunk/admin/scripts.js
r2821507 r3375111 1 /* global ajaxurl */1 /* global ajaxurl, drgfNotice */ 2 2 jQuery( document ).ready( function() { 3 3 … … 20 20 action: 'drgf_dismiss_notice', 21 21 type: type, 22 nonce: drgfNotice.nonce, 22 23 }, 23 24 } -
disable-remove-google-fonts/trunk/changelog.txt
r3325513 r3375111 1 = 1.7.1 = 2 3 * Tested with WP6.8 4 1 5 = 1.7.0 = 2 6 -
disable-remove-google-fonts/trunk/disable-remove-google-fonts.php
r3325513 r3375111 6 6 * Author: Fonts Plugin 7 7 * Author URI: https://fontsplugin.com 8 * Version: 1.7. 08 * Version: 1.7.1 9 9 * License: GPLv2 or later 10 10 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt … … 32 32 33 33 if ( ! defined( 'DRGF_VERSION' ) ) { 34 define( 'DRGF_VERSION', '1.7. 0' );34 define( 'DRGF_VERSION', '1.7.1' ); 35 35 } 36 36 -
disable-remove-google-fonts/trunk/inc/remove-google-fonts.php
r3325513 r3375111 41 41 * Dequeue Google Fonts based on URL. 42 42 */ 43 function drgf_dequeue u_fonts() {43 function drgf_dequeue_fonts() { 44 44 // Remove fonts added by the Divi Extra theme. 45 45 remove_action( 'wp_footer', 'et_builder_print_font' ); … … 109 109 } 110 110 111 add_action( 'wp_enqueue_scripts', 'drgf_dequeue u_fonts', PHP_INT_MAX );112 add_action( 'wp_print_styles', 'drgf_dequeue u_fonts', PHP_INT_MAX );111 add_action( 'wp_enqueue_scripts', 'drgf_dequeue_fonts', PHP_INT_MAX ); 112 add_action( 'wp_print_styles', 'drgf_dequeue_fonts', PHP_INT_MAX ); 113 113 114 114 /** … … 202 202 * Dequeue Google Fonts loaded by Avada theme. 203 203 */ 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 ); 204 if ( 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 } 217 219 } 218 220 … … 277 279 */ 278 280 function drgf_strposa( $haystack, $needles, $offset = 0 ) { 279 $chr = array();280 281 foreach ( $needles as $needle ) { 281 282 $res = strpos( $haystack, $needle, $offset ); … … 341 342 ); 342 343 343 add_action( 'plugins_loaded', 'd grf_after_plugins_loaded', 9999 );344 add_action( 'plugins_loaded', 'drgf_after_plugins_loaded', 9999 ); 344 345 345 346 /** 346 347 * Run this code after all plugins have been loaded. 347 348 */ 348 function d grf_after_plugins_loaded() {349 function drgf_after_plugins_loaded() { 349 350 /** 350 351 * Dequeue Google Fonts loaded by the GroovyMenu plugin. -
disable-remove-google-fonts/trunk/readme.txt
r3325513 r3375111 3 3 Tags: gdpr, dsgvo, google fonts, disable google fonts, optimize 4 4 Requires at least: 4.8 5 Tested up to: 6. 75 Tested up to: 6.8 6 6 License: GPLv2 or later 7 7 Stable tag: trunk
Note: See TracChangeset
for help on using the changeset viewer.