| 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="https://wpsites.net/product/custom-fonts-for-your-visual-editor-in-wordpress/">Add Custom Fonts</a> |
| 6 |
Version: 3.0 |
| 7 |
Author: WP Sites fonts@wpsites.net |
| 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 |
// Include CSS for styling |
| 17 |
function fonts_dummy_enqueue_styles() { |
| 18 |
wp_enqueue_style( 'fonts-dummy-admin', plugin_dir_url( __FILE__ ) . 'assets/css/admin.css', array(), '3.0' ); |
| 19 |
} |
| 20 |
add_action( 'admin_enqueue_scripts', 'fonts_dummy_enqueue_styles' ); |
| 21 |
|
| 22 |
// Fix menu spacing with inline CSS and JavaScript |
| 23 |
function fonts_dummy_fix_menu_spacing() { |
| 24 |
?> |
| 25 |
<style> |
| 26 |
/* Make Fonts menu spacing match default WordPress menu items */ |
| 27 |
#adminmenu li#toplevel_page_fonts-pro { |
| 28 |
margin: 0 !important; |
| 29 |
padding: 0 !important; |
| 30 |
} |
| 31 |
|
| 32 |
/* Fix the br tag in menu image - same as default */ |
| 33 |
#adminmenu li#toplevel_page_fonts-pro .wp-menu-image br { |
| 34 |
display: none !important; |
| 35 |
} |
| 36 |
|
| 37 |
/* Make menu image match default styling */ |
| 38 |
#adminmenu li#toplevel_page_fonts-pro .wp-menu-image { |
| 39 |
height: 20px !important; |
| 40 |
line-height: 20px !important; |
| 41 |
margin: 0 !important; |
| 42 |
padding: 0 !important; |
| 43 |
} |
| 44 |
|
| 45 |
/* Make menu name match default styling */ |
| 46 |
#adminmenu li#toplevel_page_fonts-pro .wp-menu-name { |
| 47 |
padding: 8px 0 !important; |
| 48 |
line-height: 1.4 !important; |
| 49 |
margin: 0 !important; |
| 50 |
} |
| 51 |
|
| 52 |
/* Make the main menu link match default styling */ |
| 53 |
#adminmenu li#toplevel_page_fonts-pro a.menu-top { |
| 54 |
padding: 8px 0 !important; |
| 55 |
margin: 0 !important; |
| 56 |
display: block !important; |
| 57 |
} |
| 58 |
|
| 59 |
/* Override menu-top-last class spacing */ |
| 60 |
#adminmenu li#toplevel_page_fonts-pro.menu-top-last { |
| 61 |
margin-bottom: 0 !important; |
| 62 |
padding-bottom: 0 !important; |
| 63 |
} |
| 64 |
|
| 65 |
/* Ensure consistent spacing with other menu items */ |
| 66 |
#adminmenu li#toplevel_page_fonts-pro + li { |
| 67 |
margin-top: 0 !important; |
| 68 |
} |
| 69 |
</style> |
| 70 |
|
| 71 |
<script> |
| 72 |
jQuery(document).ready(function($) { |
| 73 |
// Remove menu-top-last class and add menu-top-first to fix spacing |
| 74 |
$('#toplevel_page_fonts-pro').removeClass('menu-top-last').addClass('menu-top-first'); |
| 75 |
$('#toplevel_page_fonts-pro a').removeClass('menu-top-last').addClass('menu-top-first'); |
| 76 |
}); |
| 77 |
</script> |
| 78 |
<?php |
| 79 |
} |
| 80 |
add_action( 'admin_head', 'fonts_dummy_fix_menu_spacing' ); |
| 81 |
|
| 82 |
// Hook to add the admin menu |
| 83 |
add_action('admin_menu', 'fonts_dummy_menu'); |
| 84 |
function fonts_dummy_menu() { |
| 85 |
add_menu_page( |
| 86 |
'Fonts', // Page title |
| 87 |
'Fonts', // Menu title |
| 88 |
'manage_options', // Capability |
| 89 |
'fonts-pro', // Menu slug |
| 90 |
'fonts_dummy_dashboard_page', // Callback function |
| 91 |
'dashicons-editor-textcolor', // Icon |
| 92 |
20 // Position - moved up to avoid menu-top-last |
| 93 |
); |
| 94 |
|
| 95 |
// Add submenu pages (dummy - non-functional) |
| 96 |
add_submenu_page( |
| 97 |
'fonts-pro', |
| 98 |
'Dashboard', |
| 99 |
'Dashboard', |
| 100 |
'manage_options', |
| 101 |
'fonts-pro', |
| 102 |
'fonts_dummy_dashboard_page' |
| 103 |
); |
| 104 |
|
| 105 |
add_submenu_page( |
| 106 |
'fonts-pro', |
| 107 |
'Google Fonts <span style="color: #e74c3c; font-weight: bold;">PRO</span>', |
| 108 |
'Google Fonts <span style="color: #e74c3c; font-weight: bold;">PRO</span>', |
| 109 |
'manage_options', |
| 110 |
'fonts-pro-google', |
| 111 |
'fonts_dummy_google_fonts_page' |
| 112 |
); |
| 113 |
|
| 114 |
add_submenu_page( |
| 115 |
'fonts-pro', |
| 116 |
'Custom Fonts <span style="color: #27ae60; font-weight: bold;">PRO</span>', |
| 117 |
'Custom Fonts <span style="color: #27ae60; font-weight: bold;">PRO</span>', |
| 118 |
'manage_options', |
| 119 |
'fonts-pro-custom', |
| 120 |
'fonts_dummy_custom_fonts_page' |
| 121 |
); |
| 122 |
|
| 123 |
add_submenu_page( |
| 124 |
'fonts-pro', |
| 125 |
'Settings <span style="color: #3498db; font-weight: bold;">PRO</span>', |
| 126 |
'Settings <span style="color: #3498db; font-weight: bold;">PRO</span>', |
| 127 |
'manage_options', |
| 128 |
'fonts-pro-settings', |
| 129 |
'fonts_dummy_settings_page' |
| 130 |
); |
| 131 |
} |
| 132 |
|
| 133 |
function fonts_dummy_dashboard_page() { |
| 134 |
?> |
| 135 |
<div class="wrap"> |
| 136 |
<h1>Fonts Dashboard</h1> |
| 137 |
|
| 138 |
<div class="fonts-pro-dashboard"> |
| 139 |
<div class="fonts-pro-quick-actions"> |
| 140 |
<h2>Quick Actions</h2> |
| 141 |
<div class="action-buttons"> |
| 142 |
<a href="<?php echo admin_url( 'admin.php?page=fonts-pro-google' ); ?>" class="button button-primary"> |
| 143 |
Add Google Fonts |
| 144 |
</a> |
| 145 |
<a href="<?php echo admin_url( 'admin.php?page=fonts-pro-custom' ); ?>" class="button button-primary"> |
| 146 |
Upload Custom Fonts |
| 147 |
</a> |
| 148 |
<a href="<?php echo admin_url( 'admin.php?page=fonts-pro-settings' ); ?>" class="button button-secondary"> |
| 149 |
Settings |
| 150 |
</a> |
| 151 |
</div> |
| 152 |
</div> |
| 153 |
|
| 154 |
<div class="fonts-pro-upgrade-notice" style="background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 20px; margin-top: 20px;"> |
| 155 |
<h2>Upgrade to Fonts Pro</h2> |
| 156 |
<p>This is the free version of Fonts. To access all features, <a href="https://wpsites.net/product/custom-fonts-for-your-visual-editor-in-wordpress/" target="_blank">upgrade to Fonts Pro</a>:</p> |
| 157 |
<ul style="margin-left: 20px; list-style-type: disc;"> |
| 158 |
<li>Google Fonts integration with 1896 fonts</li> |
| 159 |
<li>Custom font uploads (WOFF, WOFF2, TTF, OTF)</li> |
| 160 |
<li>Advanced typography controls</li> |
| 161 |
<li>Performance optimization</li> |
| 162 |
<li>Editor integration</li> |
| 163 |
</ul> |
| 164 |
<p style="margin-top: 15px;"> |
| 165 |
<a href="https://wpsites.net/product/custom-fonts-for-your-visual-editor-in-wordpress/" class="button button-primary" target="_blank"> |
| 166 |
Get Fonts Pro Now |
| 167 |
</a> |
| 168 |
</p> |
| 169 |
</div> |
| 170 |
</div> |
| 171 |
</div> |
| 172 |
<?php |
| 173 |
} |
| 174 |
|
| 175 |
function fonts_dummy_google_fonts_page() { |
| 176 |
?> |
| 177 |
<div class="wrap"> |
| 178 |
<h1 class="google-fonts-header"> |
| 179 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 190 35" width="190" height="35" preserveAspectRatio="xMidYMid meet"> |
| 180 |
<!-- Google "G" Logo --> |
| 181 |
<g transform="translate(127.75,9.538)"> |
| 182 |
<g transform="translate(5.057,8.484)"> |
| 183 |
<path fill="rgb(95,99,104)" d="M-2.691,1.173 C-2.691,1.173 -2.691,8.234 -2.691,8.234 C-2.691,8.234 -4.807,8.234 -4.807,8.234 C-4.807,8.234 -4.807,-8.234 -4.807,-8.234 C-4.807,-8.234 4.807,-8.234 4.807,-8.234 C4.807,-8.234 4.807,-6.211 4.807,-6.211 C4.807,-6.211 -2.691,-6.211 -2.691,-6.211 C-2.691,-6.211 -2.691,-0.806 -2.691,-0.806 C-2.691,-0.806 4.072,-0.806 4.072,-0.806 C4.072,-0.806 4.072,1.173 4.072,1.173 C4.072,1.173 -2.691,1.173 -2.691,1.173z"/> |
| 184 |
</g> |
| 185 |
<g transform="translate(16.619,11.083)"> |
| 186 |
<path fill="rgb(95,99,104)" d="M-5.796,0 C-5.796,-1.732 -5.252,-3.166 -4.163,-4.301 C-3.059,-5.436 -1.671,-6.003 0,-6.003 C1.672,-6.003 3.051,-5.436 4.14,-4.301 C5.244,-3.166 5.796,-1.732 5.796,0 C5.796,1.748 5.244,3.182 4.14,4.301 C3.051,5.436 1.672,6.003 0,6.003 C-1.671,6.003 -3.059,5.436 -4.163,4.301 C-5.252,3.166 -5.796,1.732 -5.796,0z M-3.68,0 C-3.68,1.211 -3.327,2.192 -2.622,2.943 C-1.917,3.695 -1.043,4.07 0,4.07 C1.043,4.07 1.917,3.695 2.622,2.943 C3.327,2.192 3.68,1.211 3.68,0 C3.68,-1.196 3.327,-2.17 2.622,-2.921 C1.901,-3.688 1.027,-4.071 0,-4.071 C-1.028,-4.071 -1.902,-3.688 -2.622,-2.921 C-3.327,-2.17 -3.68,-1.196 -3.68,0z"/> |
| 187 |
</g> |
| 188 |
<g transform="translate(29.205,10.899)"> |
| 189 |
<path fill="rgb(95,99,104)" d="M-4.991,-5.451 C-4.991,-5.451 -2.967,-5.451 -2.967,-5.451 C-2.967,-5.451 -2.967,-3.888 -2.967,-3.888 C-2.967,-3.888 -2.875,-3.888 -2.875,-3.888 C-2.553,-4.439 -2.058,-4.899 -1.391,-5.267 C-0.724,-5.636 -0.031,-5.819 0.691,-5.819 C2.071,-5.819 3.132,-5.425 3.875,-4.635 C4.619,-3.846 4.991,-2.722 4.991,-1.265 C4.991,-1.265 4.991,5.819 4.991,5.819 C4.991,5.819 2.875,5.819 2.875,5.819 C2.875,5.819 2.875,-1.128 2.875,-1.128 C2.829,-2.968 1.902,-3.888 0.092,-3.888 C-0.752,-3.888 -1.457,-3.546 -2.024,-2.864 C-2.592,-2.181 -2.875,-1.365 -2.875,-0.415 C-2.875,-0.415 -2.875,5.819 -2.875,5.819 C-2.875,5.819 -4.991,5.819 -4.991,5.819 C-4.991,5.819 -4.991,-5.451 -4.991,-5.451z"/> |
| 190 |
</g> |
| 191 |
<g transform="translate(39.074,9.45)"> |
| 192 |
<path fill="rgb(95,99,104)" d="M1.633,7.452 C0.713,7.452 -0.051,7.168 -0.656,6.6 C-1.262,6.033 -1.572,5.244 -1.588,4.232 C-1.588,4.232 -1.588,-2.07 -1.588,-2.07 C-1.588,-2.07 -3.565,-2.07 -3.565,-2.07 C-3.565,-2.07 -3.565,-4.001 -3.565,-4.001 C-3.565,-4.001 -1.588,-4.001 -1.588,-4.001 C-1.588,-4.001 -1.588,-7.452 -1.588,-7.452 C-1.588,-7.452 0.529,-7.452 0.529,-7.452 C0.529,-7.452 0.529,-4.001 0.529,-4.001 C0.529,-4.001 3.288,-4.001 3.288,-4.001 C3.288,-4.001 3.288,-2.07 3.288,-2.07 C3.288,-2.07 0.529,-2.07 0.529,-2.07 C0.529,-2.07 0.529,3.542 0.529,3.542 C0.529,4.293 0.674,4.804 0.966,5.072 C1.257,5.341 1.587,5.473 1.954,5.473 C2.123,5.473 2.288,5.455 2.449,5.417 C2.611,5.379 2.76,5.328 2.898,5.266 C2.898,5.266 3.565,7.152 3.565,7.152 C3.013,7.351 2.368,7.452 1.633,7.452z"/> |
| 193 |
</g> |
| 194 |
<g transform="translate(48.071,11.083)"> |
| 195 |
<path fill="rgb(95,99,104)" d="M4.681,2.507 C4.681,3.488 4.251,4.317 3.393,4.991 C2.534,5.665 1.452,6.003 0.15,6.003 C-0.985,6.003 -1.983,5.707 -2.841,5.117 C-3.7,4.528 -4.313,3.749 -4.681,2.783 C-4.681,2.783 -2.796,1.978 -2.796,1.978 C-2.519,2.653 -2.117,3.178 -1.588,3.554 C-1.059,3.929 -0.479,4.117 0.15,4.117 C0.825,4.117 1.388,3.972 1.84,3.68 C2.292,3.389 2.518,3.044 2.518,2.645 C2.518,1.924 1.967,1.396 0.863,1.058 C0.863,1.058 -1.07,0.575 -1.07,0.575 C-3.263,0.023 -4.359,-1.035 -4.359,-2.599 C-4.359,-3.626 -3.942,-4.451 -3.106,-5.071 C-2.27,-5.692 -1.2,-6.003 0.104,-6.003 C1.1,-6.003 2.001,-5.765 2.806,-5.29 C3.611,-4.814 4.174,-4.179 4.495,-3.381 C4.495,-3.381 2.61,-2.599 2.61,-2.599 C2.395,-3.074 2.047,-3.446 1.564,-3.715 C1.081,-3.982 0.539,-4.117 -0.058,-4.117 C-0.61,-4.117 -1.105,-3.979 -1.542,-3.703 C-1.979,-3.427 -2.197,-3.09 -2.197,-2.691 C-2.197,-2.047 -1.591,-1.587 -0.381,-1.311 C-0.381,-1.311 1.323,-0.874 1.323,-0.874 C3.561,-0.322 4.681,0.805 4.681,2.507z"/> |
| 196 |
</g> |
| 197 |
</g> |
| 198 |
|
| 199 |
<!-- "Fonts" Text --> |
| 200 |
<g transform="translate(45.75,7.75)"> |
| 201 |
<g transform="translate(9.361,9.559)"> |
| 202 |
<path fill="rgb(95,99,104)" d="M0.376,9.309 C-4.777,9.309 -9.111,5.132 -9.111,0 C-9.111,-5.131 -4.777,-9.309 0.376,-9.309 C3.228,-9.309 5.257,-8.196 6.786,-6.743 C6.786,-6.743 4.982,-4.95 4.982,-4.95 C3.888,-5.971 2.406,-6.766 0.376,-6.766 C-3.387,-6.766 -6.329,-3.746 -6.329,0 C-6.329,3.747 -3.387,6.767 0.376,6.767 C2.816,6.767 4.208,5.79 5.098,4.905 C5.827,4.178 6.307,3.134 6.488,1.703 C6.488,1.703 0.376,1.703 0.376,1.703 C0.376,1.703 0.376,-0.84 0.376,-0.84 C0.376,-0.84 8.975,-0.84 8.975,-0.84 C9.066,-0.386 9.111,0.16 9.111,0.75 C9.111,2.657 8.586,5.018 6.898,6.699 C5.256,8.401 3.159,9.309 0.376,9.309z"/> |
| 203 |
</g> |
| 204 |
<g transform="translate(25.838,12.874)"> |
| 205 |
<path fill="rgb(95,99,104)" d="M5.935,0 C5.935,3.451 3.269,5.994 0,5.994 C-3.27,5.994 -5.935,3.451 -5.935,0 C-5.935,-3.474 -3.27,-5.994 0,-5.994 C3.269,-5.994 5.935,-3.474 5.935,0z M3.337,0 C3.337,-2.157 1.79,-3.633 0,-3.633 C-1.792,-3.633 -3.338,-2.157 -3.338,0 C-3.338,2.134 -1.792,3.633 0,3.633 C1.79,3.633 3.337,2.134 3.337,0z"/> |
| 206 |
</g> |
| 207 |
<g transform="translate(39.141,12.874)"> |
| 208 |
<path fill="rgb(95,99,104)" d="M5.935,0 C5.935,3.451 3.269,5.994 0,5.994 C-3.27,5.994 -5.935,3.451 -5.935,0 C-5.935,-3.474 -3.27,-5.994 0,-5.994 C3.269,-5.994 5.935,-3.474 5.935,0z M3.337,0 C3.337,-2.157 1.791,-3.633 0,-3.633 C-1.792,-3.633 -3.337,-2.157 -3.337,0 C-3.337,2.134 -1.792,3.633 0,3.633 C1.791,3.633 3.337,2.134 3.337,0z"/> |
| 209 |
</g> |
| 210 |
<g transform="translate(52.275,15.565)"> |
| 211 |
<path fill="rgb(95,99,104)" d="M5.77,-8.322 C5.77,-8.322 5.77,2.441 5.77,2.441 C5.77,6.869 3.148,8.685 0.046,8.685 C-2.873,8.685 -4.629,6.732 -5.29,5.143 C-5.29,5.143 -2.988,4.189 -2.988,4.189 C-2.577,5.165 -1.574,6.323 0.046,6.323 C2.03,6.323 3.262,5.098 3.262,2.804 C3.262,2.804 3.262,1.941 3.262,1.941 C3.262,1.941 3.171,1.941 3.171,1.941 C2.578,2.668 1.437,3.303 0.001,3.303 C-3.01,3.303 -5.77,0.693 -5.77,-2.668 C-5.77,-6.051 -3.01,-8.685 0.001,-8.685 C1.437,-8.685 2.578,-8.049 3.171,-7.345 C3.171,-7.345 3.262,-7.345 3.262,-7.345 C3.262,-7.345 3.262,-8.322 3.262,-8.322 C3.262,-8.322 5.77,-8.322 5.77,-8.322z M3.444,-2.668 C3.444,-4.779 2.03,-6.324 0.229,-6.324 C-1.596,-6.324 -3.124,-4.779 -3.124,-2.668 C-3.124,-0.579 -1.596,0.942 0.229,0.942 C2.03,0.942 3.444,-0.579 3.444,-2.668z"/> |
| 212 |
</g> |
| 213 |
<g transform="translate(61.36,9.695)"> |
| 214 |
<path fill="rgb(95,99,104)" d="M1.323,8.809 C1.323,8.809 -1.323,8.809 -1.323,8.809 C-1.323,8.809 -1.323,-8.809 -1.323,-8.809 C-1.323,-8.809 1.323,-8.809 1.323,-8.809 C1.323,-8.809 1.323,8.809 1.323,8.809z"/> |
| 215 |
</g> |
| 216 |
<g transform="translate(69.738,12.874)"> |
| 217 |
<path fill="rgb(95,99,104)" d="M3.344,1.975 C3.344,1.975 5.397,3.337 5.397,3.337 C4.737,4.314 3.139,5.993 0.38,5.993 C-3.04,5.993 -5.511,3.361 -5.511,0.001 C-5.511,-3.564 -3.019,-5.993 0.084,-5.993 C3.209,-5.993 4.737,-3.52 5.238,-2.18 C5.238,-2.18 5.511,-1.499 5.511,-1.499 C5.511,-1.499 -2.539,1.816 -2.539,1.816 C-1.923,3.019 -0.966,3.633 0.38,3.633 C1.725,3.633 2.661,2.974 3.344,1.975z M-2.973,-0.182 C-2.973,-0.182 2.41,-2.406 2.41,-2.406 C2.113,-3.155 1.224,-3.678 0.174,-3.678 C-1.171,-3.678 -3.04,-2.498 -2.973,-0.182z"/> |
| 218 |
</g> |
| 219 |
</g> |
| 220 |
|
| 221 |
<!-- Google Logo Colors --> |
| 222 |
<g transform="translate(1.25,5.75)"> |
| 223 |
<g transform="translate(12,11.75)"> |
| 224 |
<path fill="rgb(251,188,4)" d="M-11.75,11.5 C-11.75,11.5 2.75,-11.5 2.75,-11.5 C2.75,-11.5 11.75,-11.5 11.75,-11.5 C11.75,-11.5 11.75,-8.3 11.75,-8.3 C11.75,-8.3 -0.75,11.5 -0.75,11.5"/> |
| 225 |
</g> |
| 226 |
</g> |
| 227 |
<g transform="translate(15.75,5.75)"> |
| 228 |
<g transform="translate(4.75,11.75)"> |
| 229 |
<path fill="rgb(26,115,232)" d="M4.5,11.5 C4.5,11.5 -4.5,11.5 -4.5,11.5 C-4.5,11.5 -4.5,-11.5 -4.5,-11.5 C-4.5,-11.5 4.5,-11.5 4.5,-11.5 C4.5,-11.5 4.5,11.5 4.5,11.5z"/> |
| 230 |
</g> |
| 231 |
</g> |
| 232 |
<g transform="translate(24.75,15.75)"> |
| 233 |
<g transform="translate(3.5,6.75)"> |
| 234 |
<path fill="rgb(52,168,83)" d="M3.25,0 C3.25,3.59 0.34,6.5 -3.25,6.5 C-3.25,6.5 -3.25,-6.5 -3.25,-6.5 C0.34,-6.5 3.25,-3.59 3.25,0z"/> |
| 235 |
</g> |
| 236 |
</g> |
| 237 |
<g transform="translate(18.25,15.75)"> |
| 238 |
<g transform="translate(3.5,6.75)"> |
| 239 |
<path fill="rgb(13,101,45)" d="M3.25,6.5 C-0.34,6.5 -3.25,3.59 -3.25,0 C-3.25,-3.59 -0.34,-6.5 3.25,-6.5 C3.25,-6.5 3.25,6.5 3.25,6.5z"/> |
| 240 |
</g> |
| 241 |
</g> |
| 242 |
<g transform="translate(24.75,5.75)"> |
| 243 |
<g transform="translate(2.75,5.25)"> |
| 244 |
<path fill="rgb(26,115,232)" d="M2.5,0 C2.5,2.761 0.262,5 -2.5,5 C-2.5,5 -2.5,-5 -2.5,-5 C0.262,-5 2.5,-2.761 2.5,0z"/> |
| 245 |
</g> |
| 246 |
</g> |
| 247 |
<g transform="translate(19.75,5.75)"> |
| 248 |
<g transform="translate(2.75,5.25)"> |
| 249 |
<path fill="rgb(23,78,166)" d="M2.5,5 C-0.262,5 -2.5,2.761 -2.5,0 C-2.5,-2.761 -0.262,-5 2.5,-5 C2.5,-5 2.5,5 2.5,5z"/> |
| 250 |
</g> |
| 251 |
</g> |
| 252 |
<g transform="translate(1.75,5.75)"> |
| 253 |
<g transform="translate(4.75,4.75)"> |
| 254 |
<path fill="rgb(234,67,53)" d="M-4.5,0 C-4.5,-2.485 -2.485,-4.5 0,-4.5 C2.485,-4.5 4.5,-2.485 4.5,0 C4.5,2.485 2.485,4.5 0,4.5 C-2.485,4.5 -4.5,2.485 -4.5,0z"/> |
| 255 |
</g> |
| 256 |
</g> |
| 257 |
</svg> |
| 258 |
</h1> |
| 259 |
|
| 260 |
<div class="notice notice-warning"> |
| 261 |
<p> |
| 262 |
<strong>Google Fonts API Key Required</strong><br> |
| 263 |
To search and add Google Fonts, you need to configure your API key in the |
| 264 |
<a href="<?php echo admin_url( 'admin.php?page=fonts-pro-settings' ); ?>">Settings</a> |
| 265 |
page. Without an API key, you can still use the fallback fonts. |
| 266 |
</p> |
| 267 |
</div> |
| 268 |
|
| 269 |
<div class="fonts-pro-google-fonts"> |
| 270 |
<div class="google-fonts-search"> |
| 271 |
<input type="text" id="google-fonts-search" placeholder="Search Google Fonts..." disabled /> |
| 272 |
<button type="button" id="search-google-fonts" class="button" disabled>Search</button> |
| 273 |
</div> |
| 274 |
|
| 275 |
<div class="google-fonts-preview" id="google-fonts-preview" style="display: none;"> |
| 276 |
<h3>Font Preview</h3> |
| 277 |
<div id="preview-content"></div> |
| 278 |
</div> |
| 279 |
|
| 280 |
<div class="google-fonts-list" id="google-fonts-list"> |
| 281 |
<div class="notice notice-info"> |
| 282 |
<p><strong>Upgrade Required:</strong> This feature is available in Fonts Pro. <a href="https://wpsites.net/product/custom-fonts-for-your-visual-editor-in-wordpress/" target="_blank">Get Fonts Pro now</a> to access Google Fonts integration.</p> |
| 283 |
</div> |
| 284 |
</div> |
| 285 |
|
| 286 |
<div class="selected-google-fonts"> |
| 287 |
<h3>Added Google Fonts</h3> |
| 288 |
<div id="selected-google-fonts"> |
| 289 |
<p>No Google Fonts added yet. Upgrade to Fonts Pro to add Google Fonts.</p> |
| 290 |
</div> |
| 291 |
</div> |
| 292 |
</div> |
| 293 |
</div> |
| 294 |
<?php |
| 295 |
} |
| 296 |
|
| 297 |
function fonts_dummy_custom_fonts_page() { |
| 298 |
?> |
| 299 |
<div class="wrap"> |
| 300 |
<h1>Custom Fonts PRO</h1> |
| 301 |
|
| 302 |
<div class="fonts-pro-custom-fonts"> |
| 303 |
<div class="custom-font-upload"> |
| 304 |
<h3>Upload Custom Font</h3> |
| 305 |
<form id="custom-font-upload-form" enctype="multipart/form-data"> |
| 306 |
<table class="form-table"> |
| 307 |
<tr> |
| 308 |
<th scope="row">Font Name</th> |
| 309 |
<td> |
| 310 |
<input type="text" name="font_name" required disabled /> |
| 311 |
</td> |
| 312 |
</tr> |
| 313 |
<tr> |
| 314 |
<th scope="row">Font Family</th> |
| 315 |
<td> |
| 316 |
<input type="text" name="font_family" required disabled /> |
| 317 |
</td> |
| 318 |
</tr> |
| 319 |
<tr> |
| 320 |
<th scope="row">Font Files</th> |
| 321 |
<td> |
| 322 |
<input type="file" name="font_files[]" multiple accept=".woff,.woff2,.ttf,.otf" required disabled /> |
| 323 |
<p class="description">Upload WOFF, WOFF2, TTF, or OTF files. Multiple files for different weights/styles.</p> |
| 324 |
</td> |
| 325 |
</tr> |
| 326 |
<tr> |
| 327 |
<th scope="row">Font Weights</th> |
| 328 |
<td> |
| 329 |
<input type="text" name="font_weights" placeholder="400,700" disabled /> |
| 330 |
<p class="description">Comma-separated list of font weights (e.g., 400,700)</p> |
| 331 |
</td> |
| 332 |
</tr> |
| 333 |
<tr> |
| 334 |
<th scope="row">Font Styles</th> |
| 335 |
<td> |
| 336 |
<input type="text" name="font_styles" placeholder="normal,italic" disabled /> |
| 337 |
<p class="description">Comma-separated list of font styles (e.g., normal,italic)</p> |
| 338 |
</td> |
| 339 |
</tr> |
| 340 |
</table> |
| 341 |
<p class="submit"> |
| 342 |
<button type="submit" class="button button-primary" disabled>Upload Font</button> |
| 343 |
</p> |
| 344 |
</form> |
| 345 |
|
| 346 |
<div class="notice notice-info"> |
| 347 |
<p><strong>Upgrade Required:</strong> Custom font uploads are available in Fonts Pro. <a href="https://wpsites.net/product/custom-fonts-for-your-visual-editor-in-wordpress/" target="_blank">Get Fonts Pro now</a> to upload and use custom fonts.</p> |
| 348 |
</div> |
| 349 |
</div> |
| 350 |
|
| 351 |
<div class="custom-fonts-list"> |
| 352 |
<h3>Uploaded Custom Fonts</h3> |
| 353 |
<div id="custom-fonts-list"> |
| 354 |
<p>No custom fonts uploaded yet. Upgrade to Fonts Pro to upload custom fonts.</p> |
| 355 |
</div> |
| 356 |
</div> |
| 357 |
</div> |
| 358 |
</div> |
| 359 |
<?php |
| 360 |
} |
| 361 |
|
| 362 |
function fonts_dummy_settings_page() { |
| 363 |
?> |
| 364 |
<div class="wrap"> |
| 365 |
<h1>Fonts Settings PRO</h1> |
| 366 |
|
| 367 |
<form method="post" action="options.php"> |
| 368 |
<table class="form-table"> |
| 369 |
<tr> |
| 370 |
<th scope="row">Google Fonts API Key</th> |
| 371 |
<td> |
| 372 |
<input type="text" name="fonts_pro_google_api_key" id="google-api-key" value="" class="regular-text" disabled /> |
| 373 |
<button type="button" id="test-google-api" class="button" disabled>Test API Connection</button> |
| 374 |
<div id="api-test-result" style="margin-top: 10px;"></div> |
| 375 |
<p class="description"> |
| 376 |
Get your API key from <a href="https://console.developers.google.com/" target="_blank">Google Cloud Console</a> |
| 377 |
<br> |
| 378 |
<strong style="margin-top: 20px; display: block;">Setup Instructions:</strong> |
| 379 |
<ol> |
| 380 |
<li>Go to <a href="https://console.developers.google.com/" target="_blank">Google Cloud Console</a></li> |
| 381 |
<li>Create a new project or select an existing one</li> |
| 382 |
<li>Enable the <a href="https://console.developers.google.com/apis/library/webfonts.googleapis.com" target="_blank">Web Fonts Developer API</a></li> |
| 383 |
<li>Create credentials (API Key)</li> |
| 384 |
<li>Copy the API key and paste it above</li> |
| 385 |
<li>Click "Test API Connection" to verify it works</li> |
| 386 |
</ol> |
| 387 |
</p> |
| 388 |
</td> |
| 389 |
</tr> |
| 390 |
<tr> |
| 391 |
<th scope="row">Font Preloading</th> |
| 392 |
<td> |
| 393 |
<label> |
| 394 |
<input type="checkbox" name="fonts_pro_enable_preloading" value="1" disabled /> |
| 395 |
Enable font preloading for better performance |
| 396 |
</label> |
| 397 |
</td> |
| 398 |
</tr> |
| 399 |
<tr> |
| 400 |
<th scope="row">Host Fonts Locally</th> |
| 401 |
<td> |
| 402 |
<label> |
| 403 |
<input type="checkbox" name="fonts_pro_host_locally" value="1" disabled /> |
| 404 |
Download and host Google Fonts locally for better privacy and performance |
| 405 |
</label> |
| 406 |
</td> |
| 407 |
</tr> |
| 408 |
<tr> |
| 409 |
<th scope="row">Optimize Font Loading</th> |
| 410 |
<td> |
| 411 |
<label> |
| 412 |
<input type="checkbox" name="fonts_pro_optimize_loading" value="1" disabled /> |
| 413 |
Use font-display: swap for better loading performance |
| 414 |
</label> |
| 415 |
</td> |
| 416 |
</tr> |
| 417 |
</table> |
| 418 |
|
| 419 |
<p class="submit"> |
| 420 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes" disabled /> |
| 421 |
</p> |
| 422 |
</form> |
| 423 |
|
| 424 |
<div class="notice notice-info"> |
| 425 |
<p><strong>Upgrade Required:</strong> Advanced settings are available in Fonts Pro. <a href="https://wpsites.net/product/custom-fonts-for-your-visual-editor-in-wordpress/" target="_blank">Get Fonts Pro now</a> to access all settings and features.</p> |
| 426 |
</div> |
| 427 |
</div> |
| 428 |
<?php |
| 429 |
} |
| 430 |
|
| 431 |
function add_more_buttons($buttons) { |
| 432 |
$buttons[] = 'fontselect'; |
| 433 |
$buttons[] = 'fontsizeselect'; |
| 434 |
return $buttons; |
| 435 |
} |
| 436 |
|
| 437 |
add_filter("mce_buttons_3", "add_more_buttons"); |
| 438 |
|
| 439 |
add_action('admin_notices', 'wpsites_fonts_plugin_notice'); |
| 440 |
function wpsites_fonts_plugin_notice() { |
| 441 |
global $current_user; |
| 442 |
$user_id = $current_user->ID; |
| 443 |
/* Check that the user hasn't already clicked to ignore the message */ |
| 444 |
if ( ! get_user_meta($user_id, 'example_ignore_notice') ) { |
| 445 |
echo '<div class="updated"><p>'; |
| 446 |
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'); |
| 447 |
echo "</p></div>"; |
| 448 |
} |
| 449 |
} |
| 450 |
|
| 451 |
add_action('admin_init', 'example_nag_ignore'); |
| 452 |
function example_nag_ignore() { |
| 453 |
global $current_user; |
| 454 |
$user_id = $current_user->ID; |
| 455 |
/* If user clicks to ignore the notice, add that to their user meta */ |
| 456 |
if ( isset($_GET['example_nag_ignore']) && '0' == $_GET['example_nag_ignore'] ) { |
| 457 |
add_user_meta($user_id, 'example_ignore_notice', 'true', true); |
| 458 |
} |
| 459 |
} |
| 460 |
|