Font Organizer - Version 2.0.0

Version Description

  • Added font weight system to known elements, custom elements and custom fonts.
  • Added font preview for avaiable fonts in side menu.
  • Fixed otf font format did not work in all supported browsers.
  • Fixed font family and style is not shown in editor.
  • Fixed upload sometimes displays a PHP warning.
  • Fixed Upload fails with "Sorry, for security reasons this type of file is not allowed.".
  • Fixed delete font permission error.
  • Fixed early access fonts not loading in https.
  • Fixed multi upload error.
  • Fixed absolute urls cause errors when changing site url.
Download this release

Release Info

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

Code changes from version 2.0.1 to 2.0.0

Files changed (3) hide show
  1. font-organizer.php +4 -4
  2. readme.txt +1 -8
  3. settings.php +274 -273
font-organizer.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /**
3
  * @package Font_Organizer
4
- * @version 2.0.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: 2.0.1
12
  Author URI: https://hivewebstudios.com
13
  Text Domain: font-organizer
14
  */
@@ -21,7 +21,7 @@ define( 'FO_DEFAULT_ROLE', 'administrator' );
21
  require_once FO_ABSPATH . 'helpers/helpers.php';
22
 
23
  global $fo_db_version;
24
- $fo_db_version = '2.0.1';
25
 
26
  $upload_dir = wp_upload_dir(); // Must create a temp variable for PHP 5.3.
27
  global $fo_css_directory_path;
@@ -174,6 +174,7 @@ function fo_install() {
174
  id mediumint(9) NOT NULL AUTO_INCREMENT,
175
  name varchar(255) NOT NULL,
176
  url text DEFAULT NULL,
 
177
  custom int(1) DEFAULT 0,
178
  PRIMARY KEY (id)
179
  ) $charset_collate;";
@@ -183,7 +184,6 @@ function fo_install() {
183
  $sql = "CREATE TABLE IF NOT EXISTS $elements_table_name (
184
  id mediumint(9) NOT NULL AUTO_INCREMENT,
185
  font_id mediumint(9) NOT NULL,
186
- font_weight varchar(255),
187
  important int(1) DEFAULT 0,
188
  custom_elements TEXT DEFAULT NULL,
189
  PRIMARY KEY (id)
1
  <?php
2
  /**
3
  * @package Font_Organizer
4
+ * @version 2.0.0
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: 2.0.0
12
  Author URI: https://hivewebstudios.com
13
  Text Domain: font-organizer
14
  */
21
  require_once FO_ABSPATH . 'helpers/helpers.php';
22
 
23
  global $fo_db_version;
24
+ $fo_db_version = '2.0.0';
25
 
26
  $upload_dir = wp_upload_dir(); // Must create a temp variable for PHP 5.3.
27
  global $fo_css_directory_path;
174
  id mediumint(9) NOT NULL AUTO_INCREMENT,
175
  name varchar(255) NOT NULL,
176
  url text DEFAULT NULL,
177
+ font_weight varchar(255),
178
  custom int(1) DEFAULT 0,
179
  PRIMARY KEY (id)
180
  ) $charset_collate;";
184
  $sql = "CREATE TABLE IF NOT EXISTS $elements_table_name (
185
  id mediumint(9) NOT NULL AUTO_INCREMENT,
186
  font_id mediumint(9) NOT NULL,
 
187
  important int(1) DEFAULT 0,
188
  custom_elements TEXT DEFAULT NULL,
189
  PRIMARY KEY (id)
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: hivewebstudios,basaar,yardensade
3
  Tags: fonts,google fonts,upload font,font,google
4
  Requires at least: 3.8
5
  Tested up to: 4.7.3
6
- Stable tag: 2.0.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -39,8 +39,6 @@ Key Features:
39
  * Full support for language translation, including RTL languages.
40
  * It's awesome like its users.
41
 
42
- Coming up soon: Custom css, unistall options & more! Stay tuned.
43
-
44
  == Installation ==
45
 
46
  Just download & install the plugin from your wordpress site. Or
@@ -111,11 +109,6 @@ Example: "Arial Bold" or "Arial Italic", so you could easily use them later in t
111
 
112
  == Changelog ==
113
 
114
- = 2.0.1 =
115
- * Fixed new installs errors.
116
- * Changed some text to be clearer.
117
- * Fixed minor bugs and UI issues.
118
-
119
  = 2.0.0 =
120
  * Added font weight system to known elements, custom elements and custom fonts.
121
  * Added font preview for avaiable fonts in side menu.
3
  Tags: fonts,google fonts,upload font,font,google
4
  Requires at least: 3.8
5
  Tested up to: 4.7.3
6
+ Stable tag: 2.0.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
39
  * Full support for language translation, including RTL languages.
40
  * It's awesome like its users.
41
 
 
 
42
  == Installation ==
43
 
44
  Just download & install the plugin from your wordpress site. Or
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
112
  = 2.0.0 =
113
  * Added font weight system to known elements, custom elements and custom fonts.
114
  * Added font preview for avaiable fonts in side menu.
settings.php CHANGED
@@ -651,305 +651,306 @@ class FoSettingsPage
651
  <div class="wrap">
652
  <h1><?php _e('Font Settings', 'font-organizer'); ?></h1>
653
 
654
- <div id="poststuff">
655
- <div id="post-body" class="metabox-holder columns-2">
656
-
657
- <!-- main content -->
658
- <div id="post-body-content">
659
-
660
- <!-- General Settings Section -->
661
- <div class="postbox">
662
- <a name="step1"></a>
663
- <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('General Settings', 'font-organizer'); ?></span></h2>
664
- <div class="inside">
665
- <form method="post" action="options.php">
666
- <?php
667
- // This prints out all hidden setting fields
668
- settings_fields( 'fo_general_options' );
669
- fo_do_settings_section( 'font-setting-admin', 'setting_general' );
670
- submit_button();
671
- ?>
672
- </form>
673
- </div>
674
- </div>
675
 
676
- <!-- Add Google & Regular Fonts To Website Section -->
677
- <div class="postbox">
678
- <a name="step2"></a>
679
- <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('1. Add Fonts', 'font-organizer'); ?></span></h2>
680
- <div class="inside">
681
- <span><?php _e('Step 1: Select and add fonts to be used in your website. Select as many as you wish.', 'font-organizer'); ?></span>
682
- <br />
683
- <span><?php _e('You can select google or regular fonts.', 'font-organizer'); ?></span>
684
- <form action="" id="add_usable_font_form" name="add_usable_font_form" method="post">
685
- <table class="form-table">
686
- <tr>
687
- <th scope="row"><?php _e('Available Fonts', 'font-organizer'); ?></th>
688
- <td><?php $this->print_available_fonts_list('usable_font', __('-- Select Font --', 'font-organizer')); ?></td>
689
- </tr>
690
- <tr>
691
- <th scope="row"></th>
692
- <td>
693
- <?php wp_nonce_field( 'add_usable_font', 'add_usable_font_nonce' ); ?>
694
- <input type="submit" name="submit_usable_font" id="submit_usable_font" class="button-primary" value="<?php _e('Use This Font', 'font-organizer'); ?>" />
695
- </td>
696
- </tr>
697
- </table>
698
- </form>
699
- </div>
700
- </div>
701
-
702
- <!-- Add Custom Fonts To Website Section -->
703
- <div class="postbox">
704
- <a name="step3"></a>
705
- <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('2. Custom Fonts', 'font-organizer'); ?></span></h2>
706
- <div class="inside">
707
- <span><?php _e('Step 2: Upload custom fonts to be used in your website. Here too, you can upload as many as you wish.', 'font-organizer'); ?></span>
708
- <br />
709
- <span><?php _e('Name the font you want to upload and upload all the files formats for this font. In order to support more browsers you can click the green plus to upload more font formats. We suggest at least .woff and .woff2.', 'font-organizer'); ?></span>
710
- <p style="font-weight: 600;"><?php _e('You can now set font weight for this upload. If font name is set to an existing font name, the font weight will be added to the existing font and will be free to be used under said font name. You can always leave it Normal.', 'font-organizer'); ?></p>
711
- <div class="custom_font_message fo_warning" style="display: none;">
712
- <i class="fa fa-warning"></i>
713
- <?php _e("This font format is already selected. Reminder: you need to upload the font files for the same font weight.", "font-organizer"); ?>
714
- <span></span>
715
- </div>
716
 
717
- <form action="#" id="add_font_form" name="add_font_form" method="post" enctype="multipart/form-data">
718
- <table class="form-table">
719
- <tr>
720
- <th scope="row"><label for="font_name" class="required"><?php _e('Font Name', 'font-organizer'); ?></label></th>
721
- <td><input type="text" id="font_name" required oninvalid="this.setCustomValidity('<?php _e('Font weight name cannot be empty.', 'font-organizer'); ?>')" oninput="setCustomValidity('')" name="font_name" value="" class="required" maxlength="20" /></td>
722
- </tr>
723
- <tr>
724
- <th scope="row"><label for="font_weight" class="required"><?php _e('Font Weight', 'font-organizer'); ?></label></th>
725
- <td><?php $this->print_fonts_weights_list('font_weight'); ?></td>
726
- </tr>
727
- <tr class="font_file_wrapper">
728
- <th scope="row">
729
- <label for="font_file" class="required"><?php _e('Font Weight File', 'font-organizer'); ?></label>
730
- </th>
731
- <td id="font_file_parent" style="width:33%;">
732
- <input type="file" name="font_file[]" value="" class="add_font_file required" onfocus="this.oldvalue = this.value;" accept="<?php echo join(',',$this->supported_font_files); ?>" /><br/>
733
- <em><?php echo __('Accepted Font Format : ', 'font-organizer') . '<span style="direction: ltr">' . join(', ',$this->supported_font_files) . '</span>'; ?></em><br/>
734
- </td>
735
- <td>
736
- <a href="javascript:void(0);" class="add_button" title="<?php _e('Add Another Font Format File', 'font-organizer'); ?>"><i class="fa fa-plus fa-2x" aria-hidden="true"></i></a>
737
- <span style="font-size: 11px;font-style: italic;position: absolute;padding: 6px;"><?php _e('Add Another Font Format File', 'font-organizer'); ?></span>
738
- </td>
739
- </tr>
740
-
741
- <tr>
742
- <th scope="row"></th>
743
- <td>
744
- <?php wp_nonce_field( 'add_custom_font', 'add_custom_font_nonce' ); ?>
745
- <input type="submit" name="submit_upload_font" id="submit_upload_font" class="button-primary" value="<?php _e('Upload', 'font-organizer'); ?>" />
746
- </td>
747
- </tr>
748
- </table>
749
- </form>
750
  </div>
751
- </div>
752
 
753
- <!-- Assign Fonts To Known Elements Section -->
754
- <div class="postbox">
755
- <a name="step4"></a>
756
- <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('3. Known Elements Settings', 'font-organizer'); ?></span></h2>
757
- <div class="inside">
758
-
759
- <span><?php _e('Step 3: For each element you can assign a font you have added in step 1 & 2.', 'font-organizer'); ?></span>
760
- <p><strong><?php _e('Note: ', 'font-organizer'); ?></strong> <?php _e('Custom fonts you uploaded are automatically used in your website.', 'font-organizer'); ?></p>
761
- <p><strong><?php _e('In case of font not displaying in your website after saving, try clear the cache using Shift+F5 or Ctrl+Shift+Delete to clear all.', 'font-organizer'); ?></strong>
762
- <form method="post" action="options.php">
763
- <?php
764
- // This prints out all hidden setting fields
765
- settings_fields( 'fo_elements_options' );
766
- fo_do_settings_section( 'font-setting-admin', 'setting_elements' );
767
- submit_button();
768
- ?>
769
- </form>
770
- </div>
771
- </div>
772
-
773
- <!-- Assign Fonts To Custom Elements Section -->
774
- <div class="postbox">
775
- <a name="step5"></a>
776
- <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('4. Custom Elements Settings', 'font-organizer'); ?></span></h2>
777
- <div class="inside">
778
-
779
- <span><?php _e('Step 4: Assign font that you have added to your website to custom elements.', 'font-organizer'); ?></span>
780
- <form action="#" id="add_custom_elements_form" name="add_custom_elements_form" method="post">
781
- <table class="form-table">
782
- <tr>
783
- <th scope="row"><label for="font_id" class="required"><?php _e('Font', 'font-organizer'); ?></label></th>
784
- <td><?php $this->print_custom_elements_usable_fonts_list('font_id', __('-- Select Font --', 'font-organizer'), __("You must select a font for the elements.", "font-organizer")); ?></td>
785
- </tr>
786
- <tr>
787
- <th scope="row"><label for="font_weight" class="required"><?php _e('Font Weight', 'font-organizer'); ?></label></th>
788
- <td><?php $this->fonts_weight_list_field('font_weight'); ?></td>
789
- </tr>
790
- <tr>
791
- <th scope="row">
792
- <label for="custom_elements" class="required">
793
- <?php _e('Custom Element', 'font-organizer'); ?>
794
- </label>
795
- </th>
796
- <td>
797
- <textarea id="custom_elements" name="custom_elements" required oninvalid="this.setCustomValidity('<?php _e('Font custom elements cannot be empty.', 'font-organizer'); ?>')" oninput="setCustomValidity('')" style="width: 100%" rows="2"></textarea>
798
- <em><?php _e('Custom elements can be seperated by commas to allow multiple elements. Example: #myelementid, .myelementclass, .myelementclass .foo, etc.', 'font-organizer'); ?></em>
799
- </td>
800
- </tr>
801
- <tr>
802
- <th></th>
803
- <td><?php $this->print_is_important_checkbox('important'); ?></td>
804
- </tr>
805
- <tr>
806
- <th scope="row"></th>
807
- <td>
808
- <?php wp_nonce_field( 'add_custom_elements', 'add_custom_elements_nonce' ); ?>
809
- <input type="submit" name="submit_custom_elements" id="submit_custom_elements" class="button-primary" value="<?php _e('Apply Custom Elements', 'font-organizer'); ?>" />
810
- </td>
811
- </tr>
812
- </table>
813
- </form>
814
  </div>
815
- </div>
816
-
817
- <!-- Manage Used fonts Section -->
818
- <div class="postbox">
819
- <a name="step6"></a>
820
- <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('5. Manage Fonts', 'font-organizer'); ?></span></h2>
821
- <div class="inside">
822
- <span>
823
- <?php _e('Step 5: Select a font to manage, delete and view the source and custom elements assigned to it.', 'font-organizer'); ?>
824
- </span>
825
- <p>
826
- <strong><?php _e('Note: ', 'font-organizer'); ?></strong>
827
- <?php _e('You can edit the values of every row to change the custom elements assigned or add and remove the important tag. Just change the text or check the box and the settings will automatically save.', 'font-organizer'); ?>
828
- </p>
829
- <div class="custom_elements_message fo_success" style="display: none;">
830
- <i class="fa fa-info-circle"></i>
831
- <?php _e('Changes saved!', 'font-organizer'); ?>
832
- </div>
833
- <div class="custom_elements_message fo_warning" style="display: none;">
834
- <i class="fa fa-warning"></i>
835
- <?php _e("Data is invalid", "font-organizer"); ?>
836
- <span></span>
837
  </div>
838
- <table class="form-table">
 
 
839
  <tr>
840
- <th scope="row"><?php _e('Font', 'font-organizer'); ?></th>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
841
  <td>
842
- <form action="#step6" id="select_font_form" name="select_font_form" method="get">
843
- <?php $this->print_custom_elements_usable_fonts_list('manage_font_id', __('-- Select Font --', 'font-organizer')); ?>
844
- <input type="hidden" name="page" value="<?php echo wp_unslash( $_REQUEST['page'] ); ?>">
845
- </form>
846
  </td>
847
- <?php if($this->selected_manage_font): ?>
848
-
849
- <td style="text-align:left;">
850
- <form action="#step6" id="delete_usable_font_form" name="delete_usable_font_form" method="post">
851
- <?php wp_nonce_field( 'delete_usable_font', 'delete_usable_font_nonce' ); ?>
852
- <input type="hidden" name="page" value="<?php echo wp_unslash( $_REQUEST['page'] ); ?>">
853
- <input type="hidden" name="font_id" value="<?php echo $_GET['manage_font_id']; ?>">
854
- <input type="hidden" name="font_name" value="<?php echo $this->selected_manage_font->family; ?>">
855
- <input type="submit" name="delete_usable_font" id="delete_usable_font" class="button-secondary" value="<?php _e('Delete Font', 'font-organizer'); ?>" onclick="return confirm('<?php _e("Are you sure you want to delete this font from your website?", "font-organizer"); ?>')" />
856
- </form>
857
  </td>
858
-
859
- <?php endif; ?>
860
- </tr>
861
- </table>
862
- <?php if($this->selected_manage_font): ?>
863
- <hr/>
864
- <table class="form-table">
865
- <tr>
866
- <th scope="row"><?php _e('Source', 'font-organizer'); ?></th>
867
- <td><span><?php fo_print_source($this->selected_manage_font->kind); ?></span></td>
868
- </tr>
869
- <tr>
870
- <th scope="row"><?php _e('Urls', 'font-organizer'); ?></th>
871
- <td style="direction:ltr;text-align:left;line-height:20px;">
872
- <span>
873
- <?php
874
- foreach ($this->selected_manage_font->files as $weight => $urls) {
875
- echo '<span style="font-weight:bold">' . fo_get_font_weight($weight) . '</span><br />';
876
- if(is_array($urls)){
877
- foreach($urls as $url)
878
- echo $url, '<br>';
879
- }else{
880
- echo $this->selected_manage_font->files->regular;
881
- }
882
-
883
- echo '<br />';
884
- }
885
- ?>
886
- </span>
887
- </td>
888
- </tr>
889
- </table>
890
- <div class="wp-table-fo-container">
891
- <form id="custom_elements-filter" method="get" action="#step6">
892
- <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
893
- <input type="hidden" name="manage_font_id" value="<?php echo $_GET['manage_font_id']; ?>">
894
- <?php $this->custom_elements_table->display(); ?>
895
- </form>
896
  </div>
897
- <?php
898
- endif;
899
- ?>
900
  </div>
901
- </div>
902
-
903
- </div>
904
-
905
- <!-- sidebar -->
906
- <div id="postbox-container-1" class="postbox-container">
907
- <div class="meta-box-sortables">
908
  <div class="postbox">
909
- <h2>
910
- <span><?php esc_attr_e('Thank you', 'font-organizer'); ?></span>
911
- </h2>
912
-
913
  <div class="inside">
914
- <p><?php _e(
915
- 'Thank you for using an <a href="http://hivewebstudios.com" target="_blank">Hive</a> plugin! We 5 star you already, so why don\'t you <a href="https://wordpress.org/support/plugin/font-organizer/reviews/?rate=5#new-post" target="_blank">5 star us too</a>?', 'font-organizer'); ?>
916
- <br />
917
- <p><?php _e('Anyway, if you need anything, this may help:', 'font-organizer'); ?></p>
918
- <ul style="list-style-type:disc;margin: 0 20px;">
919
- <li><a href="http://hivewebstudios.com/font-organizer/#faq" target="_blank"><?php _e('FAQ', 'font-organizer'); ?></a></li>
920
- <li><a href="https://wordpress.org/support/plugin/font-organizer" target="_blank"><?php _e('Support forums', 'font-organizer'); ?></a></li>
921
- <li><a href="http://hivewebstudios.com/font-organizer/#contact" target="_blank"><?php _e('Contact us', 'font-organizer'); ?></a></li>
922
- </ul>
923
- </p>
 
 
924
  </div>
925
  </div>
 
 
926
  <div class="postbox">
927
- <h2>
928
- <span><?php esc_attr_e('Like Our Facebook Page', 'font-organizer'); ?></span>
929
- </h2>
930
  <div class="inside">
931
- <iframe src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2Fhivewp%2F&tabs&width=340&height=214&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId=<?php echo self::FACBOOK_APP_ID; ?>" width="100%" height="200" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
932
  </div>
933
  </div>
934
- <div class="postbox">
935
- <h2>
936
- <span><?php esc_attr_e('Font Preview', 'font-organizer'); ?></span>
937
- </h2>
938
 
 
 
 
 
939
  <div class="inside">
940
- <span><?php esc_attr_e('Select a font from the list to preview.', 'font-organizer'); ?></span>
941
- <p>
942
- <?php $this->print_available_fonts_list('font_preview_selection', __('-- Select Font --', 'font-organizer')); ?>
943
- <input type="text" id="font_preview_text" value="<?php _e("This is a preview content.", 'font-organizer'); ?>" style="width: 100%;margin: 5px 0 0;" placeholder="<?php _e('Font preview free text', 'font-organizer'); ?>" /><br>
944
- </p>
945
- <div id="font_preview_demo">
946
- <?php _e("This is a preview content.", 'font-organizer'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
947
  </div>
948
- <span style="font-size: 11px;font-style:italic"><?php echo __('Note: ', 'font-organizer') . __('Some fonts may not support your language.', 'font-organizer'); ?></span>
949
  </div>
950
  </div>
951
  </div>
952
- </div>
953
  </div>
954
  <?php
955
  }
651
  <div class="wrap">
652
  <h1><?php _e('Font Settings', 'font-organizer'); ?></h1>
653
 
654
+ <div id="poststuff">
655
+ <div id="post-body" class="metabox-holder columns-2">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656
 
657
+ <!-- main content -->
658
+ <div id="post-body-content">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
 
660
+ <!-- General Settings Section -->
661
+ <div class="postbox">
662
+ <a name="step1"></a>
663
+ <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('General Settings', 'font-organizer'); ?></span></h2>
664
+ <div class="inside">
665
+ <form method="post" action="options.php">
666
+ <?php
667
+ // This prints out all hidden setting fields
668
+ settings_fields( 'fo_general_options' );
669
+ fo_do_settings_section( 'font-setting-admin', 'setting_general' );
670
+ submit_button();
671
+ ?>
672
+ </form>
673
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
  </div>
 
675
 
676
+ <!-- Add Google & Regular Fonts To Website Section -->
677
+ <div class="postbox">
678
+ <a name="step2"></a>
679
+ <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('1. Add Fonts', 'font-organizer'); ?></span></h2>
680
+ <div class="inside">
681
+ <span><?php _e('Step 1: Select and add fonts to be used in your website. Select as many as you wish.', 'font-organizer'); ?></span>
682
+ <br />
683
+ <span><?php _e('You can select google or regular fonts.', 'font-organizer'); ?></span>
684
+ <form action="" id="add_usable_font_form" name="add_usable_font_form" method="post">
685
+ <table class="form-table">
686
+ <tr>
687
+ <th scope="row"><?php _e('Available Fonts', 'font-organizer'); ?></th>
688
+ <td><?php $this->print_available_fonts_list('usable_font', __('-- Select Font --', 'font-organizer')); ?></td>
689
+ </tr>
690
+ <tr>
691
+ <th scope="row"></th>
692
+ <td>
693
+ <?php wp_nonce_field( 'add_usable_font', 'add_usable_font_nonce' ); ?>
694
+ <input type="submit" name="submit_usable_font" id="submit_usable_font" class="button-primary" value="<?php _e('Use This Font', 'font-organizer'); ?>" />
695
+ </td>
696
+ </tr>
697
+ </table>
698
+ </form>
699
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
700
  </div>
701
+
702
+ <!-- Add Custom Fonts To Website Section -->
703
+ <div class="postbox">
704
+ <a name="step3"></a>
705
+ <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('2. Custom Fonts', 'font-organizer'); ?></span></h2>
706
+ <div class="inside">
707
+ <span><?php _e('Step 2: Upload custom fonts to be used in your website. Here too, you can upload as many as you wish.', 'font-organizer'); ?></span>
708
+ <br />
709
+ <span><?php _e('Name the font you want to upload and upload all the files formats for this font. In order to support more browsers you can click the green plus to upload more font formats. We suggest at least .woff and .woff2.', 'font-organizer'); ?></span>
710
+ <p style="font-weight: 600;"><?php _e('You can now set font weight for this upload. If font name is set to an existing font name, the font weight will be added to the existing font and will be free to be used under said font name. You can always leave it Normal.', 'font-organizer'); ?></p>
711
+ <div class="custom_font_message fo_warning" style="display: none;">
712
+ <i class="fa fa-warning"></i>
713
+ <?php _e("This font format is already selected. Reminder: you need to upload the font files for the same font weight.", "font-organizer"); ?>
714
+ <span></span>
 
 
 
 
 
 
 
 
715
  </div>
716
+
717
+ <form action="#" id="add_font_form" name="add_font_form" method="post" enctype="multipart/form-data">
718
+ <table class="form-table">
719
  <tr>
720
+ <th scope="row"><label for="font_name" class="required"><?php _e('Font Name', 'font-organizer'); ?></label></th>
721
+ <td><input type="text" id="font_name" required oninvalid="this.setCustomValidity('<?php _e('Font weight name cannot be empty.', 'font-organizer'); ?>')" oninput="setCustomValidity('')" name="font_name" value="" class="required" maxlength="20" /></td>
722
+ </tr>
723
+ <tr>
724
+ <th scope="row"><label for="font_weight" class="required"><?php _e('Font Weight', 'font-organizer'); ?></label></th>
725
+ <td><?php $this->print_fonts_weights_list('font_weight'); ?></td>
726
+ </tr>
727
+ <tr class="font_file_wrapper">
728
+ <th scope="row">
729
+ <label for="font_file" class="required"><?php _e('Font Weight File', 'font-organizer'); ?></label>
730
+ </th>
731
+ <td id="font_file_parent" style="width:33%;">
732
+ <input type="file" name="font_file[]" value="" class="add_font_file required" onfocus="this.oldvalue = this.value;" accept="<?php echo join(',',$this->supported_font_files); ?>" /><br/>
733
+ <em><?php echo __('Accepted Font Format : ', 'font-organizer') . '<span style="direction: ltr">' . join(', ',$this->supported_font_files) . '</span>'; ?></em><br/>
734
+ </td>
735
  <td>
736
+ <a href="javascript:void(0);" class="add_button" title="<?php _e('Add Another Font Format File', 'font-organizer'); ?>"><i class="fa fa-plus fa-2x" aria-hidden="true"></i></a>
737
+ <span style="font-size: 11px;font-style: italic;position: absolute;padding: 6px;"><?php _e('Add Another Font Format File', 'font-organizer'); ?></span>
 
 
738
  </td>
739
+ </tr>
740
+
741
+ <tr>
742
+ <th scope="row"></th>
743
+ <td>
744
+ <?php wp_nonce_field( 'add_custom_font', 'add_custom_font_nonce' ); ?>
745
+ <input type="submit" name="submit_upload_font" id="submit_upload_font" class="button-primary" value="<?php _e('Upload', 'font-organizer'); ?>" />
 
 
 
746
  </td>
747
+ </tr>
748
+ </table>
749
+ </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
750
  </div>
 
 
 
751
  </div>
752
+
753
+ <!-- Assign Fonts To Known Elements Section -->
 
 
 
 
 
754
  <div class="postbox">
755
+ <a name="step4"></a>
756
+ <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('3. Known Elements Settings', 'font-organizer'); ?></span></h2>
 
 
757
  <div class="inside">
758
+
759
+ <span><?php _e('Step 3: For each element you can assign a font you have added in step 1 & 2.', 'font-organizer'); ?></span>
760
+ <p><strong><?php _e('Note: ', 'font-organizer'); ?></strong> <?php _e('Custom fonts you uploaded are automatically used in your website.', 'font-organizer'); ?></p>
761
+ <p><strong><?php _e('In case of font not displaying in your website after saving, try clear the cache using Shift+F5 or Ctrl+Shift+Delete to clear all.', 'font-organizer'); ?></strong>
762
+ <form method="post" action="options.php">
763
+ <?php
764
+ // This prints out all hidden setting fields
765
+ settings_fields( 'fo_elements_options' );
766
+ fo_do_settings_section( 'font-setting-admin', 'setting_elements' );
767
+ submit_button();
768
+ ?>
769
+ </form>
770
  </div>
771
  </div>
772
+
773
+ <!-- Assign Fonts To Custom Elements Section -->
774
  <div class="postbox">
775
+ <a name="step5"></a>
776
+ <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('4. Custom Elements Settings', 'font-organizer'); ?></span></h2>
 
777
  <div class="inside">
778
+
779
+ <span><?php _e('Step 4: Assign font that you have added to your website to custom elements.', 'font-organizer'); ?></span>
780
+ <form action="#" id="add_custom_elements_form" name="add_custom_elements_form" method="post">
781
+ <table class="form-table">
782
+ <tr>
783
+ <th scope="row"><label for="font_id" class="required"><?php _e('Font', 'font-organizer'); ?></label></th>
784
+ <td><?php $this->print_custom_elements_usable_fonts_list('font_id', __('-- Select Font --', 'font-organizer'), __("You must select a font for the elements.", "font-organizer")); ?></td>
785
+ </tr>
786
+ <tr>
787
+ <th scope="row"><label for="font_weight" class="required"><?php _e('Font Weight', 'font-organizer'); ?></label></th>
788
+ <td><?php $this->fonts_weight_list_field('font_weight'); ?></td>
789
+ </tr>
790
+ <tr>
791
+ <th scope="row">
792
+ <label for="custom_elements" class="required">
793
+ <?php _e('Custom Element', 'font-organizer'); ?>
794
+ </label>
795
+ </th>
796
+ <td>
797
+ <textarea id="custom_elements" name="custom_elements" required oninvalid="this.setCustomValidity('<?php _e('Font custom elements cannot be empty.', 'font-organizer'); ?>')" oninput="setCustomValidity('')" style="width: 100%" rows="2"></textarea>
798
+ <em><?php _e('Custom elements can be seperated by commas to allow multiple elements. Example: #myelementid, .myelementclass, .myelementclass .foo, etc.', 'font-organizer'); ?></em>
799
+ </td>
800
+ </tr>
801
+ <tr>
802
+ <th></th>
803
+ <td><?php $this->print_is_important_checkbox('important'); ?></td>
804
+ </tr>
805
+ <tr>
806
+ <th scope="row"></th>
807
+ <td>
808
+ <?php wp_nonce_field( 'add_custom_elements', 'add_custom_elements_nonce' ); ?>
809
+ <input type="submit" name="submit_custom_elements" id="submit_custom_elements" class="button-primary" value="<?php _e('Apply Custom Elements', 'font-organizer'); ?>" />
810
+ </td>
811
+ </tr>
812
+ </table>
813
+ </form>
814
  </div>
815
  </div>
 
 
 
 
816
 
817
+ <!-- Manage Used fonts Section -->
818
+ <div class="postbox">
819
+ <a name="step6"></a>
820
+ <h2 class="hndle ui-sortable-handle" style="cursor:default;"><span><?php _e('5. Manage Fonts', 'font-organizer'); ?></span></h2>
821
  <div class="inside">
822
+ <span>
823
+ <?php _e('Step 5: Select a font to manage, delete and view the source and custom elements assigned to it.', 'font-organizer'); ?>
824
+ </span>
825
+ <p>
826
+ <strong><?php _e('Note: ', 'font-organizer'); ?></strong>
827
+ <?php _e('You can edit the values of every row to change the custom elements assigned or add and remove the important tag. Just change the text or check the box and the settings will automatically save.', 'font-organizer'); ?>
828
+ </p>
829
+ <div class="custom_elements_message fo_success" style="display: none;">
830
+ <i class="fa fa-info-circle"></i>
831
+ <?php _e('Changes saved!', 'font-organizer'); ?>
832
+ </div>
833
+ <div class="custom_elements_message fo_warning" style="display: none;">
834
+ <i class="fa fa-warning"></i>
835
+ <?php _e("Data is invalid", "font-organizer"); ?>
836
+ <span></span>
837
+ </div>
838
+ <table class="form-table">
839
+ <tr>
840
+ <th scope="row"><?php _e('Font', 'font-organizer'); ?></th>
841
+ <td>
842
+ <form action="#step6" id="select_font_form" name="select_font_form" method="get">
843
+ <?php $this->print_custom_elements_usable_fonts_list('manage_font_id', __('-- Select Font --', 'font-organizer')); ?>
844
+ <input type="hidden" name="page" value="<?php echo wp_unslash( $_REQUEST['page'] ); ?>">
845
+ </form>
846
+ </td>
847
+ <?php if($this->selected_manage_font): ?>
848
+
849
+ <td style="text-align:left;">
850
+ <form action="#step6" id="delete_usable_font_form" name="delete_usable_font_form" method="post">
851
+ <?php wp_nonce_field( 'delete_usable_font', 'delete_usable_font_nonce' ); ?>
852
+ <input type="hidden" name="page" value="<?php echo wp_unslash( $_REQUEST['page'] ); ?>">
853
+ <input type="hidden" name="font_id" value="<?php echo $_GET['manage_font_id']; ?>">
854
+ <input type="hidden" name="font_name" value="<?php echo $this->selected_manage_font->family; ?>">
855
+ <input type="submit" name="delete_usable_font" id="delete_usable_font" class="button-secondary" value="<?php _e('Delete Font', 'font-organizer'); ?>" onclick="return confirm('<?php _e("Are you sure you want to delete this font from your website?", "font-organizer"); ?>')" />
856
+ </form>
857
+ </td>
858
+
859
+ <?php endif; ?>
860
+ </tr>
861
+ </table>
862
+ <?php if($this->selected_manage_font): ?>
863
+ <hr/>
864
+ <table class="form-table">
865
+ <tr>
866
+ <th scope="row"><?php _e('Source', 'font-organizer'); ?></th>
867
+ <td><span><?php fo_print_source($this->selected_manage_font->kind); ?></span></td>
868
+ </tr>
869
+ <tr>
870
+ <th scope="row"><?php _e('Urls', 'font-organizer'); ?></th>
871
+ <td style="direction:ltr;text-align:left;line-height:20px;">
872
+ <span>
873
+ <?php
874
+ foreach ($this->selected_manage_font->files as $weight => $urls) {
875
+ echo '<span style="font-weight:bold">' . fo_get_font_weight($weight) . '</span><br />';
876
+ if(is_array($urls)){
877
+ foreach($urls as $url)
878
+ echo $url, '<br>';
879
+ }else{
880
+ echo $this->selected_manage_font->files->regular;
881
+ }
882
+
883
+ echo '<br />';
884
+ }
885
+ ?>
886
+ </span>
887
+ </td>
888
+ </tr>
889
+ </table>
890
+ <div class="wp-table-fo-container">
891
+ <form id="custom_elements-filter" method="get" action="#step6">
892
+ <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
893
+ <input type="hidden" name="manage_font_id" value="<?php echo $_GET['manage_font_id']; ?>">
894
+ <?php $this->custom_elements_table->display(); ?>
895
+ </form>
896
+ </div>
897
+ <?php
898
+ endif;
899
+ ?>
900
+ </div>
901
+ </div>
902
+
903
+ </div>
904
+
905
+ <!-- sidebar -->
906
+ <div id="postbox-container-1" class="postbox-container">
907
+ <div class="meta-box-sortables">
908
+ <div class="postbox">
909
+ <h2>
910
+ <span><?php esc_attr_e('Thank you', 'font-organizer'); ?></span>
911
+ </h2>
912
+
913
+ <div class="inside">
914
+ <p><?php _e(
915
+ 'Thank you for using an <a href="http://hivewebstudios.com" target="_blank">Hive</a> plugin! We 5 star you already, so why don\'t you <a href="https://wordpress.org/support/plugin/font-organizer/reviews/?rate=5#new-post" target="_blank">5 star us too</a>?', 'font-organizer'); ?>
916
+ <br />
917
+ <p><?php _e('Anyway, if you need anything, this may help:', 'font-organizer'); ?></p>
918
+ <ul style="list-style-type:disc;margin: 0 20px;">
919
+ <li><a href="http://hivewebstudios.com/font-organizer/#faq" target="_blank"><?php _e('FAQ', 'font-organizer'); ?></a></li>
920
+ <li><a href="https://wordpress.org/support/plugin/font-organizer" target="_blank"><?php _e('Support forums', 'font-organizer'); ?></a></li>
921
+ <li><a href="http://hivewebstudios.com/font-organizer/#contact" target="_blank"><?php _e('Contact us', 'font-organizer'); ?></a></li>
922
+ </ul>
923
+ </p>
924
+ </div>
925
+ </div>
926
+ <div class="postbox">
927
+ <h2>
928
+ <span><?php esc_attr_e('Like Our Facebook Page', 'font-organizer'); ?></span>
929
+ </h2>
930
+ <div class="inside">
931
+ <iframe src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2Fhivewp%2F&tabs&width=340&height=214&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId=<?php echo self::FACBOOK_APP_ID; ?>" width="100%" height="200" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
932
+ </div>
933
+ </div>
934
+ <div class="postbox">
935
+ <h2>
936
+ <span><?php esc_attr_e('Font Preview', 'font-organizer'); ?></span>
937
+ </h2>
938
+
939
+ <div class="inside">
940
+ <span><?php esc_attr_e('Select a font from the list to preview.', 'font-organizer'); ?></span>
941
+ <p>
942
+ <?php $this->print_available_fonts_list('font_preview_selection', __('-- Select Font --', 'font-organizer')); ?>
943
+ <input type="text" id="font_preview_text" value="<?php _e("This is a preview content.", 'font-organizer'); ?>" style="width: 100%;margin: 5px 0 0;" placeholder="<?php _e('Font preview free text', 'font-organizer'); ?>" /><br>
944
+ </p>
945
+ <div id="font_preview_demo">
946
+ <?php _e("This is a preview content.", 'font-organizer'); ?>
947
+ </div>
948
+ <span style="font-size: 11px;font-style:italic"><?php echo __('Note: ', 'font-organizer') . __('Some fonts may not support your language.', 'font-organizer'); ?></span>
949
  </div>
 
950
  </div>
951
  </div>
952
  </div>
953
+ </form>
954
  </div>
955
  <?php
956
  }