Use Any Font - Version 6.1.8

Version Description

  • Added wpnonce for forms
Download this release

Release Info

Developer dnesscarkey
Plugin Icon 128x128 Use Any Font
Version 6.1.8
Comparing to
See all releases

Code changes from version 6.1.7 to 6.1.8

includes/functions/uaf_admin_functions.php CHANGED
@@ -164,28 +164,24 @@ function uaf_check_site_url(){
164
  }
165
 
166
  function uaf_save_options(){
167
- if ( isset($_POST['uaf_nonce']) && wp_verify_nonce($_POST['uaf_nonce'], 'uaf_save_settings')) {
168
- $all_fields_name = array(
169
- 'uaf_server_url_type',
170
- 'uaf_uploader_type',
171
- 'uaf_use_absolute_font_path',
172
- 'uaf_disbale_editor_font_list',
173
- 'uaf_enable_multi_lang_support',
174
- 'uaf_font_display_property'
175
- );
176
-
177
- foreach ($all_fields_name as $fieldname) {
178
- update_option($fieldname,sanitize_text_field($_POST[$fieldname]));
179
- }
180
 
181
- uaf_get_options();
182
- uaf_write_css();
183
- $return['status'] = 'ok';
184
- $return['body'] = 'Settings Saved';
185
- } else {
186
- $return['status'] = 'error';
187
- $return['body'] = 'Sorry, your nonce did not verify. Please try again.';
188
- }
189
  return $return;
190
  }
191
 
@@ -222,44 +218,80 @@ function uaf_admin_notices(){
222
 
223
  function uaf_trigger_actions(){
224
  $actionReturn = array();
 
 
 
 
225
 
226
  if (isset($_POST['uaf_api_key_activate'])){
227
- $actionReturn = uaf_api_key_activate();
 
 
 
 
228
  }
229
 
230
  if (isset($_POST['uaf_api_key_deactivate'])){
231
- $actionReturn = uaf_api_key_deactivate();
 
 
 
 
232
  }
233
 
234
  if (isset($_POST['uaf_api_key_hide'])){
235
- $actionReturn = uaf_api_key_hide();
 
 
 
 
236
  }
237
 
238
  if (isset($_POST['submit-uaf-font-js'])){
239
- $actionReturn = uaf_save_font_files($_POST['font_name'], $_POST['convert_response']);
240
  }
241
 
242
  if (isset($_POST['submit-uaf-font-php'])){
243
- $actionReturn = uaf_upload_font_to_server();
244
- if ($actionReturn['status'] == 'success'){
245
- $actionReturn = uaf_save_font_files($_POST['font_name'], $actionReturn['body']);
246
- }
 
 
 
 
247
  }
248
 
249
  if (isset($_POST['submit-uaf-font-assign'])){
250
- $actionReturn = uaf_save_font_assign();
 
 
 
 
251
  }
252
 
253
  if (isset($_GET['delete_font_assign_key'])){
254
- $actionReturn = uaf_delete_font_assign();
 
 
 
 
255
  }
256
 
257
  if (isset($_GET['delete_font_key'])){
258
- $actionReturn = uaf_delete_font();
 
 
 
 
259
  }
260
 
261
  if (isset($_POST['save-uaf-options'])){
262
- $actionReturn = uaf_save_options();
 
 
 
 
263
  }
264
 
265
  if (isset($_GET['predefinedfontid'])){
164
  }
165
 
166
  function uaf_save_options(){
167
+
168
+ $all_fields_name = array(
169
+ 'uaf_server_url_type',
170
+ 'uaf_uploader_type',
171
+ 'uaf_use_absolute_font_path',
172
+ 'uaf_disbale_editor_font_list',
173
+ 'uaf_enable_multi_lang_support',
174
+ 'uaf_font_display_property'
175
+ );
 
 
 
 
176
 
177
+ foreach ($all_fields_name as $fieldname) {
178
+ update_option($fieldname,sanitize_text_field($_POST[$fieldname]));
179
+ }
180
+
181
+ uaf_get_options();
182
+ uaf_write_css();
183
+ $return['status'] = 'ok';
184
+ $return['body'] = 'Settings Saved';
185
  return $return;
186
  }
187
 
218
 
219
  function uaf_trigger_actions(){
220
  $actionReturn = array();
221
+ $actionReturnNonceError = array(
222
+ 'status' => 'error',
223
+ 'body' => 'Sorry, your nonce did not verify. Please try again.'
224
+ );
225
 
226
  if (isset($_POST['uaf_api_key_activate'])){
227
+ if ( isset($_POST['uaf_nonce']) && wp_verify_nonce($_POST['uaf_nonce'], 'uaf_api_key_actions')) {
228
+ $actionReturn = uaf_api_key_activate();
229
+ } else {
230
+ $actionReturn = $actionReturnNonceError;
231
+ }
232
  }
233
 
234
  if (isset($_POST['uaf_api_key_deactivate'])){
235
+ if ( isset($_POST['uaf_nonce']) && wp_verify_nonce($_POST['uaf_nonce'], 'uaf_api_key_actions')) {
236
+ $actionReturn = uaf_api_key_deactivate();
237
+ } else {
238
+ $actionReturn = $actionReturnNonceError;
239
+ }
240
  }
241
 
242
  if (isset($_POST['uaf_api_key_hide'])){
243
+ if ( isset($_POST['uaf_nonce']) && wp_verify_nonce($_POST['uaf_nonce'], 'uaf_api_key_actions')) {
244
+ $actionReturn = uaf_api_key_hide();
245
+ } else {
246
+ $actionReturn = $actionReturnNonceError;
247
+ }
248
  }
249
 
250
  if (isset($_POST['submit-uaf-font-js'])){
251
+ $actionReturn = uaf_save_font_files($_POST['font_name'], $_POST['convert_response']);
252
  }
253
 
254
  if (isset($_POST['submit-uaf-font-php'])){
255
+ if ( isset($_POST['uaf_nonce']) && wp_verify_nonce($_POST['uaf_nonce'], 'uaf_font_upload_php')) {
256
+ $actionReturn = uaf_upload_font_to_server();
257
+ if ($actionReturn['status'] == 'success'){
258
+ $actionReturn = uaf_save_font_files($_POST['font_name'], $actionReturn['body']);
259
+ }
260
+ } else {
261
+ $actionReturn = $actionReturnNonceError;
262
+ }
263
  }
264
 
265
  if (isset($_POST['submit-uaf-font-assign'])){
266
+ if ( isset($_POST['uaf_nonce']) && wp_verify_nonce($_POST['uaf_nonce'], 'uaf_font_assign')) {
267
+ $actionReturn = uaf_save_font_assign();
268
+ } else {
269
+ $actionReturn = $actionReturnNonceError;
270
+ }
271
  }
272
 
273
  if (isset($_GET['delete_font_assign_key'])){
274
+ if ( isset($_GET['uaf_nonce']) && wp_verify_nonce($_GET['uaf_nonce'], 'uaf_delete_font_assign')) {
275
+ $actionReturn = uaf_delete_font_assign();
276
+ } else {
277
+ $actionReturn = $actionReturnNonceError;
278
+ }
279
  }
280
 
281
  if (isset($_GET['delete_font_key'])){
282
+ if ( isset($_GET['uaf_nonce']) && wp_verify_nonce($_GET['uaf_nonce'], 'uaf_delete_font')) {
283
+ $actionReturn = uaf_delete_font();
284
+ } else {
285
+ $actionReturn = $actionReturnNonceError;
286
+ }
287
  }
288
 
289
  if (isset($_POST['save-uaf-options'])){
290
+ if ( isset($_POST['uaf_nonce']) && wp_verify_nonce($_POST['uaf_nonce'], 'uaf_save_settings')) {
291
+ $actionReturn = uaf_save_options();
292
+ } else {
293
+ $actionReturn = $actionReturnNonceError;
294
+ }
295
  }
296
 
297
  if (isset($_GET['predefinedfontid'])){
includes/uaf_config.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit;
3
 
4
- $GLOBALS['uaf_current_version'] = '6.1.7';
5
 
6
 
7
  $GLOBALS['uaf_fix_settings'] = array(
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit;
3
 
4
+ $GLOBALS['uaf_current_version'] = '6.1.8';
5
 
6
 
7
  $GLOBALS['uaf_fix_settings'] = array(
includes/views/uaf_api_interface.php CHANGED
@@ -37,5 +37,6 @@
37
  <br/><br/>
38
  <strong>Note</strong> : API key is needed to connect to our server for font conversion. Our server converts your fonts to required types and sends it back. You can get the premium key from <a href="https://dineshkarki.com.np/use-any-font/api-key" target="_blank">here</a>. You can also generate Lite / Test API key from button above. Lite / Test API only allow single font conversion.
39
  </p>
 
40
  </form>
41
  </div>
37
  <br/><br/>
38
  <strong>Note</strong> : API key is needed to connect to our server for font conversion. Our server converts your fonts to required types and sends it back. You can get the premium key from <a href="https://dineshkarki.com.np/use-any-font/api-key" target="_blank">here</a>. You can also generate Lite / Test API key from button above. Lite / Test API only allow single font conversion.
39
  </p>
40
+ <?php wp_nonce_field( 'uaf_api_key_actions', 'uaf_nonce' ); ?>
41
  </form>
42
  </div>
includes/views/uaf_font_assign.php CHANGED
@@ -102,7 +102,11 @@ $fontsData = uaf_get_uploaded_font_data(); ?>
102
  </tr>
103
  <tr>
104
  <td>&nbsp;</td>
105
- <td><input type="submit" name="submit-uaf-font-assign" class="button-primary" value="Assign Font" /></td>
 
 
 
 
106
  </tr>
107
  </table>
108
  </form>
@@ -135,7 +139,7 @@ $fontsImplementData = json_decode($fontsImplementRawData, true);
135
  <td><?php echo $sn; ?></td>
136
  <td><?php echo @$fontsData[$fontImplementData['font_key']]['font_name']; ?></td>
137
  <td><?php echo $fontImplementData['font_elements'] ?></td>
138
- <td><a onclick="if (!confirm('Are you sure ?')){return false;}" href="admin.php?page=use-any-font&tab=font_assign&delete_font_assign_key=<?php echo $key; ?>">Delete</a></td>
139
  </tr>
140
  <?php endforeach; ?>
141
  <?php else: ?>
102
  </tr>
103
  <tr>
104
  <td>&nbsp;</td>
105
+ <td>
106
+ <?php wp_nonce_field( 'uaf_font_assign', 'uaf_nonce' ); ?>
107
+ <input type="submit" name="submit-uaf-font-assign" class="button-primary" value="Assign Font" />
108
+
109
+ </td>
110
  </tr>
111
  </table>
112
  </form>
139
  <td><?php echo $sn; ?></td>
140
  <td><?php echo @$fontsData[$fontImplementData['font_key']]['font_name']; ?></td>
141
  <td><?php echo $fontImplementData['font_elements'] ?></td>
142
+ <td><a onclick="if (!confirm('Are you sure ?')){return false;}" href="<?php echo wp_nonce_url( 'admin.php?page=use-any-font&tab=font_assign&delete_font_assign_key='.$key, 'uaf_delete_font_assign', 'uaf_nonce' ); ?>">Delete</a></td>
143
  </tr>
144
  <?php endforeach; ?>
145
  <?php else: ?>
includes/views/uaf_font_upload_php.php CHANGED
@@ -38,6 +38,7 @@ add_thickbox();
38
  <input type="hidden" name="api_key" value="<?php echo $GLOBALS['uaf_user_settings']['uaf_api_key']; ?>" />
39
  <input type="hidden" name="font_count" value="<?php echo uaf_count_uploaded_fonts(); ?>" />
40
  <input type="submit" name="submit-uaf-font-php" class="button-primary" value="Upload" />
 
41
  <br/>
42
  <span>By clicking on Upload, you confirm that you have rights to use this font.</span>
43
  </span>
38
  <input type="hidden" name="api_key" value="<?php echo $GLOBALS['uaf_user_settings']['uaf_api_key']; ?>" />
39
  <input type="hidden" name="font_count" value="<?php echo uaf_count_uploaded_fonts(); ?>" />
40
  <input type="submit" name="submit-uaf-font-php" class="button-primary" value="Upload" />
41
+ <?php wp_nonce_field( 'uaf_font_upload_php', 'uaf_nonce' ); ?>
42
  <br/>
43
  <span>By clicking on Upload, you confirm that you have rights to use this font.</span>
44
  </span>
includes/views/uaf_uploaded_font_list.php CHANGED
@@ -12,7 +12,7 @@ if (!empty($fontsData)):
12
  <div class="font_meta">
13
  <div class="font_name"><?php echo ucfirst($fontData['font_name']); ?></div>
14
  <?php /* <div class="class_name"><?php echo $fontData['font_name'] ?></div> */ ?>
15
- <div class="delete_link"><a onclick="if (!confirm('Are you sure ?')){return false;}" href="admin.php?page=use-any-font&tab=font_upload&delete_font_key=<?php echo $key; ?>">Delete</a></div>
16
  </div>
17
 
18
  <div class="font_demo">
12
  <div class="font_meta">
13
  <div class="font_name"><?php echo ucfirst($fontData['font_name']); ?></div>
14
  <?php /* <div class="class_name"><?php echo $fontData['font_name'] ?></div> */ ?>
15
+ <div class="delete_link"><a onclick="if (!confirm('Are you sure ?')){return false;}" href="<?php echo wp_nonce_url( 'admin.php?page=use-any-font&tab=font_upload&delete_font_key='.$key, 'uaf_delete_font', 'uaf_nonce' ); ?>">Delete</a></div>
16
  </div>
17
 
18
  <div class="font_demo">
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: dnesscarkey
3
  Tags: custom fonts, font embed, font uploader, typography, install font
4
  Requires at least: 3.0
5
- Tested up to: 5.8.1
6
- Stable tag: 6.1.7
7
 
8
  Embed any custom font using font uploader and assign to elements. Upload font in 1 format and other needed formats are auto converted even woff2.
9
 
@@ -143,6 +143,9 @@ Please do write us after integration and we will add it in our supported list.
143
 
144
  == Changelog ==
145
 
 
 
 
146
  = 6.1.7 =
147
  * Fixed rtl issue for Font Search
148
 
2
  Contributors: dnesscarkey
3
  Tags: custom fonts, font embed, font uploader, typography, install font
4
  Requires at least: 3.0
5
+ Tested up to: 5.8.2
6
+ Stable tag: 6.1.8
7
 
8
  Embed any custom font using font uploader and assign to elements. Upload font in 1 format and other needed formats are auto converted even woff2.
9
 
143
 
144
  == Changelog ==
145
 
146
+ = 6.1.8 =
147
+ * Added wpnonce for forms
148
+
149
  = 6.1.7 =
150
  * Fixed rtl issue for Font Search
151
 
use-any-font.php CHANGED
@@ -5,7 +5,7 @@ Plugin Name: Use Any Font
5
  Plugin URI: https://dineshkarki.com.np/use-any-font
6
  Description: Embed any font in your website
7
  Author: Dnesscarkey
8
- Version: 6.1.7
9
  Author URI: https://dineshkarki.com.np/use-any-font
10
  */
11
 
5
  Plugin URI: https://dineshkarki.com.np/use-any-font
6
  Description: Embed any font in your website
7
  Author: Dnesscarkey
8
+ Version: 6.1.8
9
  Author URI: https://dineshkarki.com.np/use-any-font
10
  */
11