| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Fonts |
| 4 |
Plugin URI: https://wpsites.net/best-plugins/plugin-fonts-styles-sizes-wordpress/ |
| 5 |
Description: Premium Upgrades: <a href="http://wpsites.net/wordpress-themes/add-custom-fonts-to-the-wordpress-editor/">Add Google & Custom Fonts</a> | <a href="https://wordpress.org/support/plugin/fonts/reviews/?filter=5">Click here to leave a review</a> |
| 6 |
Version: 2.4 |
| 7 |
Author: Brad Dalton - WP Sites |
| 8 |
Author URI: https://wpsites.net/bradley-james-dalton-wordpress-developer/ |
| 9 |
License: GPL2 |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
die( 'Sorry, you are not allowed to access this page directly.' ); |
| 14 |
} |
| 15 |
|
| 16 |
function add_more_buttons($buttons) { |
| 17 |
$buttons[] = 'fontselect'; |
| 18 |
$buttons[] = 'fontsizeselect'; |
| 19 |
return $buttons; |
| 20 |
} |
| 21 |
|
| 22 |
add_filter("mce_buttons_3", "add_more_buttons"); |
| 23 |
|
| 24 |
add_action('admin_notices', 'wpsites_fonts_plugin_notice'); |
| 25 |
function wpsites_fonts_plugin_notice() { |
| 26 |
global $current_user ; |
| 27 |
$user_id = $current_user->ID; |
| 28 |
/* Check that the user hasn't already clicked to ignore the message */ |
| 29 |
if ( ! get_user_meta($user_id, 'example_ignore_notice') ) { |
| 30 |
echo '<div class="updated"><p>'; |
| 31 |
printf(__('Please support fonts by leaving a review : <a href="https://wordpress.org/support/plugin/fonts/reviews/?filter=5">Click here to leave a quick review</a> | <a href="%1$s">Hide Notice</a>'), '?example_nag_ignore=0'); |
| 32 |
echo "</p></div>"; |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
add_action('admin_init', 'example_nag_ignore'); |
| 37 |
function example_nag_ignore() { |
| 38 |
global $current_user; |
| 39 |
$user_id = $current_user->ID; |
| 40 |
/* If user clicks to ignore the notice, add that to their user meta */ |
| 41 |
if ( isset($_GET['example_nag_ignore']) && '0' == $_GET['example_nag_ignore'] ) { |
| 42 |
add_user_meta($user_id, 'example_ignore_notice', 'true', true); |
| 43 |
} |
| 44 |
} |
| 45 |
|