Font Organizer - Version 1.3.2

Version Description

  • Added static google fonts list when not using an API.
  • Fixed PHP 5.2 not supported.
  • Fixed google API errors.
  • Fixed multiple uploads bug.
  • Fixed few minor bugs.
Download this release

Release Info

Developer hivewebstudios
Plugin Icon 128x128 Font Organizer
Version 1.3.2
Comparing to
See all releases

Code changes from version 1.3.1 to 1.3.2

assets/js/settings.js CHANGED
@@ -33,8 +33,48 @@ jQuery(document).ready(function(){
33
  }
34
  });
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  jQuery('#add_font_form').on('click','.remove_button', function(e){ //Once remove button is clicked
37
  e.preventDefault();
 
 
 
 
 
 
 
 
38
  jQuery(this).closest('.font_file_wrapper').remove(); //Remove field html
39
  x--; //Decrement field counter
40
  });
33
  }
34
  });
35
 
36
+ var selectedFiles = [];
37
+ jQuery('body').on('change', '.add_font_file', function() {
38
+ var element = jQuery(this);
39
+ // Remove the old selected file extension from the array if exists.
40
+ var oldFileExtesion = getFileExtension(element[0].oldvalue);
41
+ var oldIndex = selectedFiles.indexOf(oldFileExtesion);
42
+ if(oldIndex != -1) {
43
+ selectedFiles.splice(oldIndex, 1);
44
+ }
45
+
46
+ // If the file extension is empty or already exists. Remove it with wrap.
47
+ var fileExtesion = getFileExtension(element[0].files[0].name);
48
+ if(fileExtesion == "" || selectedFiles.indexOf(fileExtesion) != -1){
49
+ // Reset a fake form to reset the input field.
50
+ element.wrap('<form>').closest('form').get(0).reset();
51
+ element.unwrap();
52
+
53
+ // Show an error message for trying to upload the same font format.
54
+ jQuery('.custom_font_message.fo_warning').show().delay(5000).fadeOut();
55
+ return;
56
+ }
57
+
58
+ // Add the selected file extension to the array.
59
+ selectedFiles.push(fileExtesion);
60
+ });
61
+
62
+ function getFileExtension(name)
63
+ {
64
+ var found = name.lastIndexOf('.') + 1;
65
+ return (found > 0 ? name.substr(found) : "");
66
+ }
67
+
68
  jQuery('#add_font_form').on('click','.remove_button', function(e){ //Once remove button is clicked
69
  e.preventDefault();
70
+
71
+ var element = jQuery(this).closest('.font_file_wrapper').find('.add_font_file');
72
+ var extesion = getFileExtension(element[0].files[0].name);
73
+ var index = selectedFiles.indexOf(extesion);
74
+ if(index != -1) {
75
+ selectedFiles.splice(index, 1);
76
+ }
77
+
78
  jQuery(this).closest('.font_file_wrapper').remove(); //Remove field html
79
  x--; //Decrement field counter
80
  });
font-organizer.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /**
3
  * @package Font_Organizer
4
- * @version 1.3.1
5
  */
6
  /*
7
  Plugin Name: Font Organizer
8
  Plugin URI: https://wordpress.org/plugins/font-organizer/
9
  Description: Font Organizer is the complete solution for font implementation in WordPress websites.
10
  Author: Hive
11
- Version: 1.3.1
12
  Author URI: https://hivewebstudios.com
13
  Text Domain: font-organizer
14
  */
@@ -18,10 +18,10 @@ define( 'FO_USABLE_FONTS_DATABASE', 'fo_usable_fonts' );
18
  define( 'FO_ELEMENTS_DATABASE', 'fo_elements' );
19
  define( 'FO_DEFAULT_ROLE', 'administrator' );
20
 
21
- require_once FO_ABSPATH . 'helpers.php';
22
 
23
  global $fo_db_version;
24
- $fo_db_version = '1.3.1';
25
 
26
  $upload_dir = wp_upload_dir(); // Must create a temp variable for PHP 5.3.
27
  global $fo_css_directory_path;
@@ -128,6 +128,7 @@ function fo_add_tinymce_fonts($initArray){
128
 
129
  function fo_allow_upload_types($existing_mimes = array()){
130
  $existing_mimes['ttf'] = 'application/octet-stream';
 
131
  $existing_mimes['woff'] = 'application/x-font-woff';
132
  $existing_mimes['woff2'] = 'application/x-font-woff';
133
  $existing_mimes['otf'] = 'application/x-font-woff';
1
  <?php
2
  /**
3
  * @package Font_Organizer
4
+ * @version 1.3.2
5
  */
6
  /*
7
  Plugin Name: Font Organizer
8
  Plugin URI: https://wordpress.org/plugins/font-organizer/
9
  Description: Font Organizer is the complete solution for font implementation in WordPress websites.
10
  Author: Hive
11
+ Version: 1.3.2
12
  Author URI: https://hivewebstudios.com
13
  Text Domain: font-organizer
14
  */
18
  define( 'FO_ELEMENTS_DATABASE', 'fo_elements' );
19
  define( 'FO_DEFAULT_ROLE', 'administrator' );
20
 
21
+ require_once FO_ABSPATH . 'helpers/helpers.php';
22
 
23
  global $fo_db_version;
24
+ $fo_db_version = '1.3.2';
25
 
26
  $upload_dir = wp_upload_dir(); // Must create a temp variable for PHP 5.3.
27
  global $fo_css_directory_path;
128
 
129
  function fo_allow_upload_types($existing_mimes = array()){
130
  $existing_mimes['ttf'] = 'application/octet-stream';
131
+ $existing_mimes['eot'] = 'application/octet-stream';
132
  $existing_mimes['woff'] = 'application/x-font-woff';
133
  $existing_mimes['woff2'] = 'application/x-font-woff';
134
  $existing_mimes['otf'] = 'application/x-font-woff';
helpers/google-fonts.php ADDED
@@ -0,0 +1,16006 @@