Use Any Font - Version 4.0

Version Description

Download this release

Release Info

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

Code changes from version 3.2 to 4.0

css/uaf.css DELETED
File without changes
includes/uaf_editor_setup.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function uaf_mce_before_init( $init_array ) {
3
+
4
+ $theme_advanced_fonts = '';
5
+ $fontsRawData = get_option('uaf_font_data');
6
+ $fontsData = json_decode($fontsRawData, true);
7
+ if (!empty($fontsData)):
8
+ foreach ($fontsData as $key=>$fontData):
9
+ $theme_advanced_fonts .= ucfirst(str_replace('_',' ', $fontData['font_name'])) .'='.$fontData['font_name'].';';
10
+ endforeach;
11
+ endif;
12
+
13
+ $theme_advanced_fonts .= 'Andale Mono=Andale Mono, Times;';
14
+ $theme_advanced_fonts .= 'Arial=Arial, Helvetica, sans-serif;';
15
+ $theme_advanced_fonts .= 'Arial Black=Arial Black, Avant Garde;';
16
+ $theme_advanced_fonts .= 'Book Antiqua=Book Antiqua, Palatino;';
17
+ $theme_advanced_fonts .= 'Comic Sans MS=Comic Sans MS, sans-serif;';
18
+ $theme_advanced_fonts .= 'Courier New=Courier New, Courier;';
19
+ $theme_advanced_fonts .= 'Georgia=Georgia, Palatino;';
20
+ $theme_advanced_fonts .= 'Helvetica=Helvetica;';
21
+ $theme_advanced_fonts .= 'Impact=Impact, Chicago;';
22
+ $theme_advanced_fonts .= 'Symbol=Symbol;';
23
+ $theme_advanced_fonts .= 'Tahoma=Tahoma, Arial, Helvetica, sans-serif;';
24
+ $theme_advanced_fonts .= 'Terminal=Terminal, Monaco;';
25
+ $theme_advanced_fonts .= 'Times New Roman=Times New Roman, Times;';
26
+ $theme_advanced_fonts .= 'Trebuchet MS=Trebuchet MS, Geneva;';
27
+ $theme_advanced_fonts .= 'Verdana=Verdana, Geneva;';
28
+ $theme_advanced_fonts .= 'Webdings=Webdings;';
29
+ $theme_advanced_fonts .= 'Wingdings=Wingdings, Zapf Dingbats;';
30
+
31
+ $init_array['theme_advanced_fonts'] = $theme_advanced_fonts;
32
+ return $init_array;
33
+ }
34
+
35
+ function wp_editor_fontsize_filter( $options ) {
36
+ array_shift( $options );
37
+ array_unshift( $options, 'fontsizeselect');
38
+ array_unshift( $options, 'fontselect');
39
+ return $options;
40
+ }
includes/uaf_font_implement.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if ($_POST['submit-uaf-implement']){
3
  $fontsImplementRawData = get_option('uaf_font_implement');
4
  $fontsImplementData = json_decode($fontsImplementRawData, true);
5
  if (empty($fontsImplementData)):
@@ -28,7 +28,7 @@ if ($_POST['submit-uaf-implement']){
28
 
29
  }
30
 
31
- if ($_GET['delete_implement_key']):
32
  $fontsImplementRawData = get_option('uaf_font_implement');
33
  $fontsImplementData = json_decode($fontsImplementRawData, true);
34
  $key_to_delete = $_GET['delete_implement_key'];
1
  <?php
2
+ if (isset($_POST['submit-uaf-implement'])){
3
  $fontsImplementRawData = get_option('uaf_font_implement');
4
  $fontsImplementData = json_decode($fontsImplementRawData, true);
5
  if (empty($fontsImplementData)):
28
 
29
  }
30
 
31
+ if (isset($_GET['delete_implement_key'])):
32
  $fontsImplementRawData = get_option('uaf_font_implement');
33
  $fontsImplementData = json_decode($fontsImplementRawData, true);
34
  $key_to_delete = $_GET['delete_implement_key'];
includes/uaf_font_upload.php CHANGED
@@ -1,24 +1,19 @@
1
  <?php
2
- if ($_POST['submit-uaf-font']){
3
  $uaf_api_key = get_option('uaf_api_key');
4
  $font_file_name = $_FILES['font_file']['name'];
5
  $font_file_details = pathinfo($_FILES['font_file']['name']);
6
  $file_extension = strtolower($font_file_details['extension']);
7
- $upload_dir = wp_upload_dir();
8
  $fontUploadFinalMsg = '';
9
  $fontUploadFinalStatus = 'updated';
10
 
11
- $fontNameToStore = date('ymdhis').str_replace(' ','_',$font_file_details['filename']);
12
- $fontNameToStoreWithUrl = $upload_dir['url'].'/'.$fontNameToStore;
13
 
14
  // SEND FONT CONERSION REQUEST
15
  set_time_limit(0);
16
  $ch = curl_init();
17
- curl_setopt($ch, CURLOPT_HEADER, 0);
18
- curl_setopt($ch, CURLOPT_VERBOSE, 0);
19
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
20
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: multipart/form-data"));
21
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0Mozilla/4.0 (compatible;)");
22
  curl_setopt($ch, CURLOPT_URL, 'http://dnesscarkey.com/font-convertor/convertor/convert.php');
23
  curl_setopt($ch, CURLOPT_POST, true);
24
  $post = array(
@@ -44,7 +39,7 @@ if ($_POST['submit-uaf-font']){
44
  $fontFileContent = wp_remote_fopen($convertResponseArray[$neededFontFormat]['filename']);
45
  if (!empty($fontFileContent)):
46
  $newFileName = $fontNameToStore.'.'.$neededFontFormat;
47
- $newFilePath = $upload_dir['path'].'/'.$newFileName;
48
  $fh = fopen($newFilePath, 'w') or die("can't open file. Make sure you have write permission to your upload folder");
49
  fwrite($fh, $fontFileContent);
50
  fclose($fh);
@@ -98,12 +93,12 @@ if ($_POST['submit-uaf-font']){
98
 
99
  }
100
 
101
- if ($_GET['delete_font_key']):
102
  $fontsRawData = get_option('uaf_font_data');
103
  $fontsData = json_decode($fontsRawData, true);
104
  $key_to_delete = $_GET['delete_font_key'];
105
- @unlink(realpath($fontsData[$key_to_delete]['font_path'].'.woff'));
106
- @unlink(realpath($fontsData[$key_to_delete]['font_path'].'.eot'));
107
  unset($fontsData[$key_to_delete]);
108
  $updateFontData = json_encode($fontsData);
109
  update_option('uaf_font_data',$updateFontData);
1
  <?php
2
+ if (isset($_POST['submit-uaf-font'])){
3
  $uaf_api_key = get_option('uaf_api_key');
4
  $font_file_name = $_FILES['font_file']['name'];
5
  $font_file_details = pathinfo($_FILES['font_file']['name']);
6
  $file_extension = strtolower($font_file_details['extension']);
 
7
  $fontUploadFinalMsg = '';
8
  $fontUploadFinalStatus = 'updated';
9
 
10
+ $fontNameToStore = sanitize_file_name(date('ymdhis').$font_file_details['filename']);
11
+ $fontNameToStoreWithUrl = $fontNameToStore;
12
 
13
  // SEND FONT CONERSION REQUEST
14
  set_time_limit(0);
15
  $ch = curl_init();
 
 
16
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
 
17
  curl_setopt($ch, CURLOPT_URL, 'http://dnesscarkey.com/font-convertor/convertor/convert.php');
18
  curl_setopt($ch, CURLOPT_POST, true);
19
  $post = array(
39
  $fontFileContent = wp_remote_fopen($convertResponseArray[$neededFontFormat]['filename']);
40
  if (!empty($fontFileContent)):
41
  $newFileName = $fontNameToStore.'.'.$neededFontFormat;
42
+ $newFilePath = $uaf_upload_dir.$newFileName;
43
  $fh = fopen($newFilePath, 'w') or die("can't open file. Make sure you have write permission to your upload folder");
44
  fwrite($fh, $fontFileContent);
45
  fclose($fh);
93
 
94
  }
95
 
96
+ if (isset($_GET['delete_font_key'])):
97
  $fontsRawData = get_option('uaf_font_data');
98
  $fontsData = json_decode($fontsRawData, true);
99
  $key_to_delete = $_GET['delete_font_key'];
100
+ @unlink(realpath($uaf_upload_dir.$fontsData[$key_to_delete]['font_path'].'.woff'));
101
+ @unlink(realpath($uaf_upload_dir.$fontsData[$key_to_delete]['font_path'].'.eot'));
102
  unset($fontsData[$key_to_delete]);
103
  $updateFontData = json_encode($fontsData);
104
  update_option('uaf_font_data',$updateFontData);
includes/uaf_footer.php CHANGED
@@ -1,14 +1,10 @@
1
  <?php
2
  $server_status = get_option('uaf_server_status');
3
- if ($_POST['test_server'] || empty($server_status)){
4
  if (in_array ('curl', get_loaded_extensions())) {
5
  $test_code = date('ymdhis');
6
  $ch_test = curl_init();
7
- curl_setopt($ch_test, CURLOPT_HEADER, 0);
8
- curl_setopt($ch_test, CURLOPT_VERBOSE, 0);
9
  curl_setopt($ch_test, CURLOPT_RETURNTRANSFER, true);
10
- curl_setopt($ch_test, CURLOPT_HTTPHEADER, array("Content-type: multipart/form-data"));
11
- curl_setopt($ch_test, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0Mozilla/4.0 (compatible;)");
12
  curl_setopt($ch_test, CURLOPT_URL, 'http://dnesscarkey.com/font-convertor/server/check.php');
13
  curl_setopt($ch_test, CURLOPT_POST, true);
14
  $post = array(
@@ -49,7 +45,7 @@ $server_message = get_option('uaf_server_msg');
49
  <table class="wp-list-table widefat fixed bookmarks">
50
  <thead>
51
  <tr>
52
- <th>Instruction</th>
53
  </tr>
54
  </thead>
55
  <tbody>
@@ -60,12 +56,16 @@ $server_message = get_option('uaf_server_msg');
60
  <em><strong>Note:</strong> API key is needed to connect to our server for font conversion.</em>
61
  </li>
62
 
63
- <li>Upload your font in ttf format from <strong>Upload Fonts</strong> section. The required font format will be converted automatically by the plugin and stores in your server.
64
  <em><strong>Note:</strong> We don't store any font in our server. We delete the temporary files after conversion has been done.</em>
65
  </li>
66
 
67
  <li>Assign your font to you html elements from <strong>Assign Font</strong> section.</li>
68
 
 
 
 
 
69
  <li>You are ready now. If you still have any problem visit our <a href="http://dineshkarki.com.np/forums/forum/use-any-fonts" target="_blank">support forum</a> or you can write to us directly using our contact form.</li>
70
 
71
  </ol>
@@ -115,7 +115,8 @@ $server_message = get_option('uaf_server_msg');
115
  <tr>
116
  <td>
117
  <ul class="uaf_list">
118
- <li><a href="http://dineshkarki.com.np/forums/forum/use-any-fonts" target="_blank">View Support Forum</a></li>
 
119
  <li><a href="http://dineshkarki.com.np/rectify-my-problem" target="_blank">Rectify My Problem</a></li>
120
  <li><a href="http://dineshkarki.com.np/use-any-font/use-any-font-known-issues" target="_blank">Check Known Issues</a></li>
121
  <li><a href="http://dineshkarki.com.np/contact" target="_blank">Contact Us</a></li>
1
  <?php
2
  $server_status = get_option('uaf_server_status');
3
+ if (isset($_POST['test_server']) || empty($server_status)){
4
  if (in_array ('curl', get_loaded_extensions())) {
5
  $test_code = date('ymdhis');
6
  $ch_test = curl_init();
 
 
7
  curl_setopt($ch_test, CURLOPT_RETURNTRANSFER, true);
 
 
8
  curl_setopt($ch_test, CURLOPT_URL, 'http://dnesscarkey.com/font-convertor/server/check.php');
9
  curl_setopt($ch_test, CURLOPT_POST, true);
10
  $post = array(
45
  <table class="wp-list-table widefat fixed bookmarks">
46
  <thead>
47
  <tr>
48
+ <th>Instructions</th>
49
  </tr>
50
  </thead>
51
  <tbody>
56
  <em><strong>Note:</strong> API key is needed to connect to our server for font conversion.</em>
57
  </li>
58
 
59
+ <li>Upload your font in supported format from <strong>Upload Fonts</strong> section. The required font format will be converted automatically by the plugin and stores in your server.
60
  <em><strong>Note:</strong> We don't store any font in our server. We delete the temporary files after conversion has been done.</em>
61
  </li>
62
 
63
  <li>Assign your font to you html elements from <strong>Assign Font</strong> section.</li>
64
 
65
+ <li>You can also assign uploaded font directly from Post/Page Wordpress Editor.</li>
66
+
67
+ <li>You are are fond of visual instructions, you can check it <a href="http://dineshkarki.com.np/use-any-font/instructions" target="_blank">here</a>.</li>
68
+
69
  <li>You are ready now. If you still have any problem visit our <a href="http://dineshkarki.com.np/forums/forum/use-any-fonts" target="_blank">support forum</a> or you can write to us directly using our contact form.</li>
70
 
71
  </ol>
115
  <tr>
116
  <td>
117
  <ul class="uaf_list">
118
+ <li><a href="http://dineshkarki.com.np/use-any-font/instructions" target="_blank">View Setup Instructions</a></li>
119
+ <li><a href="http://dineshkarki.com.np/forums/forum/use-any-fonts" target="_blank">View Support Forum</a></li>
120
  <li><a href="http://dineshkarki.com.np/rectify-my-problem" target="_blank">Rectify My Problem</a></li>
121
  <li><a href="http://dineshkarki.com.np/use-any-font/use-any-font-known-issues" target="_blank">Check Known Issues</a></li>
122
  <li><a href="http://dineshkarki.com.np/contact" target="_blank">Contact Us</a></li>
includes/uaf_header.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if ($_POST['ucf_api_key_submit']){
3
  $api_key_return = wp_remote_fopen('http://dnesscarkey.com/font-convertor/api/validate_key.php?license_key='.$_POST['uaf_api_key']);
4
  $api_key_return = json_decode($api_key_return);
5
  if (!empty($api_key_return)){
@@ -12,7 +12,7 @@ if ($_POST['ucf_api_key_submit']){
12
  }
13
  }
14
 
15
- if ($_POST['ucf_api_key_remove']){
16
  delete_option('uaf_api_key');
17
  $api_message = 'Your Activation key has been removed';
18
  }
1
  <?php
2
+ if (isset($_POST['ucf_api_key_submit'])){
3
  $api_key_return = wp_remote_fopen('http://dnesscarkey.com/font-convertor/api/validate_key.php?license_key='.$_POST['uaf_api_key']);
4
  $api_key_return = json_decode($api_key_return);
5
  if (!empty($api_key_return)){
12
  }
13
  }
14
 
15
+ if (isset($_POST['ucf_api_key_remove'])){
16
  delete_option('uaf_api_key');
17
  $api_message = 'Your Activation key has been removed';
18
  }
plugin_interface.php CHANGED
@@ -4,9 +4,14 @@ add_action("admin_print_scripts", 'adminjslibs');
4
  add_action("admin_print_styles", 'adminCsslibs');
5
  add_action('wp_enqueue_scripts', 'uaf_client_css');
6
  add_action('plugins_loaded', 'uaf_update_check');
 
 
7
 
8
  function uaf_client_css() {
9
- wp_register_style( 'uaf_client_css', plugins_url('use-any-font/css/uaf.css'));
 
 
 
10
  wp_enqueue_style( 'uaf_client_css' );
11
  }
12
 
@@ -16,44 +21,111 @@ function adminjslibs(){
16
  }
17
 
18
  function adminCsslibs(){
 
 
 
19
  wp_register_style('uaf-admin-style', plugins_url('use-any-font/css/uaf_admin.css'));
20
  wp_enqueue_style('uaf-admin-style');
 
 
 
21
  }
22
 
23
  function uaf_create_menu() {
24
  add_options_page('Use Any Font', 'Use Any Font', 'administrator', __FILE__, 'uaf_settings_page');
25
  }
26
 
 
 
 
 
 
 
 
 
 
27
  function uaf_activate(){
 
28
  uaf_write_css(); //rewrite css when plugin is activated after update or somethingelse......
29
  }
30
 
31
  function uaf_update_check() { // MUST CHANGE WITH EVERY VERSION
32
  $uaf_version_check = get_option('uaf_current_version');
33
- if ($uaf_version_check != '3.2'):
34
- update_option('uaf_current_version', '3.2');
 
 
 
 
35
  uaf_write_css();
36
- endif;
37
  }
38
 
39
  function uaf_settings_page() {
 
 
 
 
 
40
  include('includes/uaf_header.php');
41
  include('includes/uaf_font_upload.php');
42
  include('includes/uaf_font_implement.php');
43
  include('includes/uaf_footer.php');
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  function uaf_write_css(){
 
 
 
 
 
47
  ob_start();
48
- $fontsRawData = get_option('uaf_font_data');
49
  $fontsData = json_decode($fontsRawData, true);
50
  if (!empty($fontsData)):
51
  foreach ($fontsData as $key=>$fontData): ?>
52
  @font-face {
53
  font-family: '<?php echo $fontData['font_name'] ?>';
54
  font-style: normal;
55
- src: url(<?php echo $fontData['font_path'] ?>.eot);
56
- src: local('<?php echo $fontData['font_name'] ?>'), url(<?php echo $fontData['font_path'] ?>.eot) format('embedded-opentype'), url(<?php echo $fontData['font_path'] ?>.woff) format('woff');
57
  }
58
  <?php
59
  endforeach;
@@ -70,10 +142,32 @@ function uaf_write_css(){
70
  endforeach;
71
  endif;
72
  $uaf_style = ob_get_contents();
73
- $uafStyleSheetPath = realpath('../wp-content/plugins/use-any-font/css/uaf.css');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  $fh = fopen($uafStyleSheetPath, 'w') or die("Can't open file");
75
  fwrite($fh, $uaf_style);
76
  fclose($fh);
77
  ob_end_clean();
78
  }
79
- ?>
 
4
  add_action("admin_print_styles", 'adminCsslibs');
5
  add_action('wp_enqueue_scripts', 'uaf_client_css');
6
  add_action('plugins_loaded', 'uaf_update_check');
7
+ add_filter('mce_buttons_2', 'wp_editor_fontsize_filter');
8
+ add_filter( 'tiny_mce_before_init', 'uaf_mce_before_init' );
9
 
10
  function uaf_client_css() {
11
+ $uaf_upload = wp_upload_dir();
12
+ $uaf_upload_url = $uaf_upload['baseurl'];
13
+ $uaf_upload_url = $uaf_upload_url . '/useanyfont/';
14
+ wp_register_style( 'uaf_client_css', $uaf_upload_url.'uaf.css');
15
  wp_enqueue_style( 'uaf_client_css' );
16
  }
17
 
21
  }
22
 
23
  function adminCsslibs(){
24
+ $uaf_upload = wp_upload_dir();
25
+ $uaf_upload_url = $uaf_upload['baseurl'];
26
+ $uaf_upload_url = $uaf_upload_url . '/useanyfont/';
27
  wp_register_style('uaf-admin-style', plugins_url('use-any-font/css/uaf_admin.css'));
28
  wp_enqueue_style('uaf-admin-style');
29
+ wp_register_style('uaf-font-style', $uaf_upload_url.'admin-uaf.css');
30
+ wp_enqueue_style('uaf-font-style');
31
+ add_editor_style($uaf_upload_url.'admin-uaf.css');
32
  }
33
 
34
  function uaf_create_menu() {
35
  add_options_page('Use Any Font', 'Use Any Font', 'administrator', __FILE__, 'uaf_settings_page');
36
  }
37
 
38
+ function uaf_create_folder() {
39
+ $uaf_upload = wp_upload_dir();
40
+ $uaf_upload_dir = $uaf_upload['basedir'];
41
+ $uaf_upload_dir = $uaf_upload_dir . '/useanyfont/';
42
+ if (! is_dir($uaf_upload_dir)) {
43
+ mkdir( $uaf_upload_dir, 0755 );
44
+ }
45
+ }
46
+
47
  function uaf_activate(){
48
+ uaf_create_folder(); // CREATE FOLDER
49
  uaf_write_css(); //rewrite css when plugin is activated after update or somethingelse......
50
  }
51
 
52
  function uaf_update_check() { // MUST CHANGE WITH EVERY VERSION
53
  $uaf_version_check = get_option('uaf_current_version');
54
+ if ($uaf_version_check != 4.0):
55
+ update_option('uaf_current_version', '4.0');
56
+ if ($uaf_version_check < 4.0):
57
+ uaf_create_folder();
58
+ uaf_move_file_to_newPath();
59
+ endif;
60
  uaf_write_css();
61
+ endif;
62
  }
63
 
64
  function uaf_settings_page() {
65
+ $uaf_upload = wp_upload_dir();
66
+ $uaf_upload_dir = $uaf_upload['basedir'];
67
+ $uaf_upload_dir = $uaf_upload_dir . '/useanyfont/';
68
+ $uaf_upload_url = $uaf_upload['baseurl'];
69
+ $uaf_upload_url = $uaf_upload_url . '/useanyfont/';
70
  include('includes/uaf_header.php');
71
  include('includes/uaf_font_upload.php');
72
  include('includes/uaf_font_implement.php');
73
  include('includes/uaf_footer.php');
74
  }
75
 
76
+ // MOVING OLD FONTFILE PATH TO NEW PATH
77
+ function uaf_move_file_to_newPath(){
78
+ $uaf_upload = wp_upload_dir();
79
+ $uaf_upload_dir = $uaf_upload['basedir'];
80
+ $uaf_upload_dir = $uaf_upload_dir . '/useanyfont/';
81
+ $fontsRawData = get_option('uaf_font_data');
82
+ $fontsData = json_decode($fontsRawData, true);
83
+ if (!empty($fontsData)):
84
+ foreach ($fontsData as $key=>$fontData):
85
+
86
+ $oldFilePathInfo = pathinfo($fontData['font_path']);
87
+ $parsedPath = parse_url($fontData['font_path']);
88
+ $relativeFilePath = $_SERVER['DOCUMENT_ROOT'].$parsedPath['path'];
89
+ $oldfilename = $oldFilePathInfo['filename'];
90
+
91
+ if (file_exists($relativeFilePath.'.woff')){
92
+
93
+ $woffFileContent = file_get_contents($relativeFilePath.'.woff');
94
+ $eotFileContent = file_get_contents($relativeFilePath.'.eot');
95
+
96
+ $fhWoff = fopen($uaf_upload_dir.'/'.$oldfilename.'.woff' , 'w') or die("can't open file. Make sure you have write permission to your upload folder");
97
+ fwrite($fhWoff, $woffFileContent);
98
+ fclose($fhWoff);
99
+
100
+ $fhEot = fopen($uaf_upload_dir.'/'.$oldfilename.'.eot' , 'w') or die("can't open file. Make sure you have write permission to your upload folder");
101
+ fwrite($fhEot, $eotFileContent);
102
+ fclose($fhEot);
103
+
104
+ $fontsData[$key]['font_path'] = $oldfilename;
105
+ }
106
+ endforeach;
107
+ endif;
108
+
109
+ $updateFontData = json_encode($fontsData);
110
+ update_option('uaf_font_data',$updateFontData);
111
+ }
112
+
113
  function uaf_write_css(){
114
+ $uaf_upload = wp_upload_dir();
115
+ $uaf_upload_dir = $uaf_upload['basedir'];
116
+ $uaf_upload_dir = $uaf_upload_dir . '/useanyfont/';
117
+ $uaf_upload_url = $uaf_upload['baseurl'];
118
+ $uaf_upload_url = $uaf_upload_url . '/useanyfont/';
119
  ob_start();
120
+ $fontsRawData = get_option('uaf_font_data');
121
  $fontsData = json_decode($fontsRawData, true);
122
  if (!empty($fontsData)):
123
  foreach ($fontsData as $key=>$fontData): ?>
124
  @font-face {
125
  font-family: '<?php echo $fontData['font_name'] ?>';
126
  font-style: normal;
127
+ src: url(<?php echo $uaf_upload_url.$fontData['font_path'] ?>.eot);
128
+ src: local('<?php echo $fontData['font_name'] ?>'), url(<?php echo $uaf_upload_url.$fontData['font_path'] ?>.eot) format('embedded-opentype'), url(<?php echo $uaf_upload_url.$fontData['font_path'] ?>.woff) format('woff');
129
  }
130
  <?php
131
  endforeach;
142
  endforeach;
143
  endif;
144
  $uaf_style = ob_get_contents();
145
+ $uafStyleSheetPath = $uaf_upload_dir.'/uaf.css';
146
+ $fh = fopen($uafStyleSheetPath, 'w') or die("Can't open file");
147
+ fwrite($fh, $uaf_style);
148
+ fclose($fh);
149
+ ob_end_clean();
150
+
151
+ ob_start();
152
+ $fontsRawData = get_option('uaf_font_data');
153
+ $fontsData = json_decode($fontsRawData, true);
154
+ if (!empty($fontsData)):
155
+ foreach ($fontsData as $key=>$fontData): ?>
156
+ @font-face {
157
+ font-family: '<?php echo $fontData['font_name'] ?>';
158
+ font-style: normal;
159
+ src: url(<?php echo $uaf_upload_url.$fontData['font_path'] ?>.eot);
160
+ src: local('<?php echo $fontData['font_name'] ?>'), url(<?php echo $uaf_upload_url.$fontData['font_path'] ?>.eot) format('embedded-opentype'), url(<?php echo $uaf_upload_url.$fontData['font_path'] ?>.woff) format('woff');
161
+ }
162
+ <?php
163
+ endforeach;
164
+ endif;
165
+ $uaf_style = ob_get_contents();
166
+ $uafStyleSheetPath = $uaf_upload_dir.'/admin-uaf.css';
167
  $fh = fopen($uafStyleSheetPath, 'w') or die("Can't open file");
168
  fwrite($fh, $uaf_style);
169
  fclose($fh);
170
  ob_end_clean();
171
  }
172
+
173
+ include('includes/uaf_editor_setup.php');
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Use Any Font ===
2
  Contributors: dnesscarkey
3
- Tags: use any font, any font, embed any font, font embed, font uploader, css font embed, @font-face embed, font conversion
4
  Requires at least: 3.0
5
- Tested up to: 3.5.2
6
- Stable tag: 3.2
7
 
8
  Embed any font in your website
9
 
@@ -19,10 +19,11 @@ Features
19
  * Quick and easy to setup. No css or any rocket science knowledge needed.
20
  * Support all major browsers including IE 6+, Firefox, Chrome, Safari, IOS, Andriod, Opera and more.
21
  * Font conversion within the plugin interface font uploader.
 
22
  * Supports font format including ttf, otf, eot, woff, svg (Upgrading more). The required font are converted automatically.
23
  * Embed fonts using @font-face css. SEO friendly and quick loading.
24
  * Multiple fonts can be used.
25
- * Faster load time as your fonts are stored on your own server.
26
  * Quick font assign interface. You can select pre defined html tags or assign it to custom css.
27
  * <a href="http://dineshkarki.com.np/forums/forum/use-any-fonts" target="_blank">Support Forum</a> to quickly resolve your issues.
28
  * <a href="http://dineshkarki.com.np/rectify-my-problem" target="_blank">Rectify My Problem</a> for personal assitance.
@@ -43,13 +44,14 @@ We don't respond to support tickets created here. Please visit our <a href="http
43
  1. Select Use Any Font under Settings
44
  1. Upload your font.
45
  1. Assign your font to element.
 
46
  1. Your fonts are working in your site now.
47
 
48
  == Frequently Asked Questions ==
49
 
50
  = Does it works with multiple fonts ? =
51
 
52
- Ya, it works with multiple fonts.
53
 
54
  = Do i need to manually convert fonts ? =
55
 
@@ -67,9 +69,15 @@ You can check our <a href="http://dineshkarki.com.np/forums/forum/use-any-fonts"
67
  == Screenshots ==
68
 
69
  1. Use Any Font Demo
 
 
70
 
71
  == Changelog ==
72
 
 
 
 
 
73
  = 3.2 =
74
  * Tested with 3.5.2
75
 
1
  === Use Any Font ===
2
  Contributors: dnesscarkey
3
+ Tags: use any font, any font, embed any font, font embed, font uploader, css3 font embed, @font-face embed, font conversion, webfont, ttf, opentype, custom fonts
4
  Requires at least: 3.0
5
+ Tested up to: 3.6
6
+ Stable tag: 4.0
7
 
8
  Embed any font in your website
9
 
19
  * Quick and easy to setup. No css or any rocket science knowledge needed.
20
  * Support all major browsers including IE 6+, Firefox, Chrome, Safari, IOS, Andriod, Opera and more.
21
  * Font conversion within the plugin interface font uploader.
22
+ * Use uploaded font directly from Editor
23
  * Supports font format including ttf, otf, eot, woff, svg (Upgrading more). The required font are converted automatically.
24
  * Embed fonts using @font-face css. SEO friendly and quick loading.
25
  * Multiple fonts can be used.
26
+ * Faster load time as your custom fonts are stored on your own server.
27
  * Quick font assign interface. You can select pre defined html tags or assign it to custom css.
28
  * <a href="http://dineshkarki.com.np/forums/forum/use-any-fonts" target="_blank">Support Forum</a> to quickly resolve your issues.
29
  * <a href="http://dineshkarki.com.np/rectify-my-problem" target="_blank">Rectify My Problem</a> for personal assitance.
44
  1. Select Use Any Font under Settings
45
  1. Upload your font.
46
  1. Assign your font to element.
47
+ 1. You can also assign the font directly from wordpress page/post editor.
48
  1. Your fonts are working in your site now.
49
 
50
  == Frequently Asked Questions ==
51
 
52
  = Does it works with multiple fonts ? =
53
 
54
+ Ya, it works with multiple fonts. For multiple font conversion request, you need to get the Premium Key.
55
 
56
  = Do i need to manually convert fonts ? =
57
 
69
  == Screenshots ==
70
 
71
  1. Use Any Font Demo
72
+ 1. Use Any Font Plugin Setup
73
+ 1. Assign font directly from Wordpress Editor
74
 
75
  == Changelog ==
76
 
77
+ = 4. =
78
+ * Added Network Site Support
79
+ * Assign font directly from Wordpress Editor
80
+
81
  = 3.2 =
82
  * Tested with 3.5.2
83
 
screenshot-2.png ADDED
Binary file
screenshot-3.png ADDED
Binary file
use-any-font.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Use Any Font
4
  Plugin URI: http://dineshkarki.com.np/use-any-font
5
  Description: Embed any font in your website
6
  Author: Dinesh Karki
7
- Version: 3.2
8
  Author URI: http://www.dineshkarki.com.np
9
  */
10
 
4
  Plugin URI: http://dineshkarki.com.np/use-any-font
5
  Description: Embed any font in your website
6
  Author: Dinesh Karki
7
+ Version: 4.0
8
  Author URI: http://www.dineshkarki.com.np
9
  */
10