Version Description
First Release
Download this release
Release Info
Developer | dnesscarkey |
Plugin | Use Any Font |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- css/uaf.css +0 -0
- css/uaf_admin.css +3 -0
- includes/uaf_font_implement.php +167 -0
- includes/uaf_font_upload.php +204 -0
- includes/uaf_footer.php +60 -0
- includes/uaf_header.php +52 -0
- js/jquery.uaf_validation.js +257 -0
- js/jquery.validate.min.js +4 -0
- plugin_interface.php +66 -0
- readme.txt +57 -0
- screenshot-1.png +0 -0
- use-any-font.php +27 -0
css/uaf.css
ADDED
File without changes
|
css/uaf_admin.css
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
table.uaf_form td{ border:none !important;}
|
2 |
+
table.uaf_form td label.error{ color:#900; padding-left:5px;}
|
3 |
+
span.active_key{ padding-left:50px; font-weight:bold; color:#060;}
|
includes/uaf_font_implement.php
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)):
|
6 |
+
$fontsImplementData = array();
|
7 |
+
endif;
|
8 |
+
|
9 |
+
$fontElements = array();
|
10 |
+
$fontElements[] = @join(', ',$_POST['elements']);
|
11 |
+
$fontElements[] = @join(', ',array_filter(array_map('trim',explode("\n", trim($_POST['custom_elements'])))));
|
12 |
+
$fontElements = array_filter(array_map('trim',$fontElements));
|
13 |
+
$finalElements = join(', ', $fontElements);
|
14 |
+
|
15 |
+
if (!empty($finalElements)){
|
16 |
+
$fontsImplementData[date('ymdhis')] = array(
|
17 |
+
'font_key' => $_POST['font_key'],
|
18 |
+
'font_elements' => $finalElements
|
19 |
+
);
|
20 |
+
$updateFontsImplementData = json_encode($fontsImplementData);
|
21 |
+
update_option('uaf_font_implement',$updateFontsImplementData);
|
22 |
+
uaf_write_css();
|
23 |
+
$implementMsg = 'Font Assigned';
|
24 |
+
|
25 |
+
} else {
|
26 |
+
$implementMsg = "Couldn't assign font. Please select atleast one element or add a custom element";
|
27 |
+
}
|
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'];
|
35 |
+
unset($fontsImplementData[$key_to_delete]);
|
36 |
+
$updateFontsImplementData = json_encode($fontsImplementData);
|
37 |
+
update_option('uaf_font_implement',$updateFontsImplementData);
|
38 |
+
uaf_write_css();
|
39 |
+
$implementMsg = 'Font assign removed';
|
40 |
+
endif;
|
41 |
+
?>
|
42 |
+
|
43 |
+
<table class="wp-list-table widefat fixed bookmarks">
|
44 |
+
<thead>
|
45 |
+
<tr>
|
46 |
+
<th>Assign Font</th>
|
47 |
+
</tr>
|
48 |
+
</thead>
|
49 |
+
<tbody>
|
50 |
+
<tr>
|
51 |
+
<td>
|
52 |
+
|
53 |
+
<?php if (!empty($implementMsg)):?>
|
54 |
+
<div class="updated" id="message"><p><?php echo $implementMsg ?></p></div>
|
55 |
+
<?php endif; ?>
|
56 |
+
|
57 |
+
<?php
|
58 |
+
$fontsRawData = get_option('uaf_font_data');
|
59 |
+
$fontsData = json_decode($fontsRawData, true);
|
60 |
+
?>
|
61 |
+
|
62 |
+
<p align="right"><input type="button" name="open_assign_font" onClick="open_assign_font();" class="button-primary" value="Assign Font" /><br/></p>
|
63 |
+
|
64 |
+
<div id="open_assign_font" style="display:none;">
|
65 |
+
<form action="options-general.php?page=use-any-font/plugin_interface.php" id="open_assign_font_form" method="post">
|
66 |
+
<table class="uaf_form">
|
67 |
+
<tr>
|
68 |
+
<td width="175">Select Font</td>
|
69 |
+
<td>
|
70 |
+
<select name="font_key" class="required" style="width:200px;">
|
71 |
+
<option value="">- Select -</option>
|
72 |
+
<?php
|
73 |
+
if (!empty($fontsData)):
|
74 |
+
foreach ($fontsData as $key=>$fontData) : ?>
|
75 |
+
<option value="<?php echo $key ?>"><?php echo $fontData['font_name']; ?></option>
|
76 |
+
<?php endforeach;
|
77 |
+
endif;
|
78 |
+
?>
|
79 |
+
</select>
|
80 |
+
</td>
|
81 |
+
</tr>
|
82 |
+
<tr>
|
83 |
+
<td valign="top">Select elements to assign</td>
|
84 |
+
<td>
|
85 |
+
<input name="elements[]" value="body" type="checkbox" /> All (body tags)<br/>
|
86 |
+
<input name="elements[]" value="h1" type="checkbox" /> Headline 1 (h1 tags)<br/>
|
87 |
+
<input name="elements[]" value="h2" type="checkbox" /> Headline 2 (h2 tags)<br/>
|
88 |
+
<input name="elements[]" value="h3" type="checkbox" /> Headline 3 (h3 tags)<br/>
|
89 |
+
<input name="elements[]" value="h4" type="checkbox" /> Headline 4 (h4 tags)<br/>
|
90 |
+
<input name="elements[]" value="h5" type="checkbox" /> Headline 5 (h5 tags)<br/>
|
91 |
+
<input name="elements[]" value="h6" type="checkbox" /> Headline 6 (h6 tags)<br/>
|
92 |
+
<input name="elements[]" value="p" type="checkbox" /> Paragraphs (p tags)<br/>
|
93 |
+
<input name="elements[]" value="blockquote" type="checkbox" /> Blockquotes<br/>
|
94 |
+
<input name="elements[]" value="li" type="checkbox" /> Lists (li tags)
|
95 |
+
</td>
|
96 |
+
</tr>
|
97 |
+
<tr>
|
98 |
+
<td valign="top">Custom Elements</td>
|
99 |
+
<td><textarea name="custom_elements" style="width:400px; height:150px;"></textarea><br/>
|
100 |
+
<br/>
|
101 |
+
<strong>Note</strong><br/>
|
102 |
+
Each line indicate one css element. You don't need to use any css.<br />
|
103 |
+
<strong>Example:</strong><br/>
|
104 |
+
<em>#content .wrap</em><br/>
|
105 |
+
<em>#content p </em>
|
106 |
+
<br/>
|
107 |
+
</td>
|
108 |
+
</tr>
|
109 |
+
<tr>
|
110 |
+
<td> </td>
|
111 |
+
<td><input type="submit" name="submit-uaf-implement" class="button-primary" value="Assign Font" /></td>
|
112 |
+
</tr>
|
113 |
+
</table>
|
114 |
+
</form>
|
115 |
+
<br/><br/>
|
116 |
+
</div>
|
117 |
+
|
118 |
+
<?php
|
119 |
+
$fontsImplementRawData = get_option('uaf_font_implement');
|
120 |
+
$fontsImplementData = json_decode($fontsImplementRawData, true);
|
121 |
+
|
122 |
+
?>
|
123 |
+
<table cellspacing="0" class="wp-list-table widefat fixed bookmarks">
|
124 |
+
<thead>
|
125 |
+
<tr>
|
126 |
+
<th width="20">Sn</th>
|
127 |
+
<th>Font</th>
|
128 |
+
<th>Applied To</th>
|
129 |
+
<th width="100">Delete</th>
|
130 |
+
</tr>
|
131 |
+
</thead>
|
132 |
+
|
133 |
+
<tbody>
|
134 |
+
<?php if (!empty($fontsImplementData)): ?>
|
135 |
+
<?php
|
136 |
+
$sn = 0;
|
137 |
+
foreach ($fontsImplementData as $key=>$fontImplementData):
|
138 |
+
$sn++
|
139 |
+
?>
|
140 |
+
<tr>
|
141 |
+
<td><?php echo $sn; ?></td>
|
142 |
+
<td><?php echo $fontsData[$fontImplementData['font_key']]['font_name']; ?></td>
|
143 |
+
<td><?php echo $fontImplementData['font_elements'] ?></td>
|
144 |
+
<td><a onclick="if (!confirm('Are you sure ?')){return false;}" href="options-general.php?page=use-any-font/plugin_interface.php&delete_implement_key=<?php echo $key; ?>">Delete</a></td>
|
145 |
+
</tr>
|
146 |
+
<?php endforeach; ?>
|
147 |
+
<?php else: ?>
|
148 |
+
<tr>
|
149 |
+
<td colspan="4">No font assign yet. Click on Assign Font to start.</td>
|
150 |
+
</tr>
|
151 |
+
<?php endif; ?>
|
152 |
+
</tbody>
|
153 |
+
|
154 |
+
</table>
|
155 |
+
|
156 |
+
<script>
|
157 |
+
function open_assign_font(){
|
158 |
+
jQuery('#open_assign_font').toggle('fast');
|
159 |
+
jQuery("#open_assign_font_form").validate();
|
160 |
+
}
|
161 |
+
</script>
|
162 |
+
|
163 |
+
<br/>
|
164 |
+
</td>
|
165 |
+
</tr>
|
166 |
+
</tbody>
|
167 |
+
</table>
|
includes/uaf_font_upload.php
ADDED
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
if ($file_extension == 'woff'):
|
9 |
+
$newFileName = date('ymdhis').$_FILES['font_file']['name'];
|
10 |
+
$newFilePath = $upload_dir['path'].'/'.$newFileName;
|
11 |
+
$newFileUrl = $upload_dir['url'].'/'.$newFileName;
|
12 |
+
move_uploaded_file($_FILES['font_file']['tmp_name'],$newFilePath);
|
13 |
+
else:
|
14 |
+
$fontNameToStore = date('ymdhis').$font_file_details['filename'];
|
15 |
+
$fontNameToStoreWithUrl = $upload_dir['url'].'/'.$fontNameToStore;
|
16 |
+
//CONVERT TO WOFF
|
17 |
+
$ch = curl_init();
|
18 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
19 |
+
curl_setopt($ch, CURLOPT_VERBOSE, 0);
|
20 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
21 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: multipart/form-data"));
|
22 |
+
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0Mozilla/4.0 (compatible;)");
|
23 |
+
curl_setopt($ch, CURLOPT_URL, 'http://dineshkarki.com.np/font-convertor/woff.php');
|
24 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
25 |
+
$post = array(
|
26 |
+
'ttffile' => "@".$_FILES['font_file']['tmp_name'],
|
27 |
+
'api_key' => $uaf_api_key
|
28 |
+
);
|
29 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
30 |
+
$response = curl_exec($ch);
|
31 |
+
if(curl_errno($ch)) {
|
32 |
+
echo 'Error: ' . curl_error($ch);
|
33 |
+
exit();
|
34 |
+
}
|
35 |
+
else {
|
36 |
+
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
37 |
+
if ($http_code == 200) {
|
38 |
+
$newFileName = $fontNameToStore.'.woff';
|
39 |
+
$newFilePath = $upload_dir['path'].'/'.$newFileName;
|
40 |
+
$fh = fopen($newFilePath, 'w') or die("Can't open file");
|
41 |
+
fwrite($fh, $response);
|
42 |
+
fclose($fh);
|
43 |
+
} else {
|
44 |
+
echo $response;
|
45 |
+
exit();
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
//CONVERT TO EOT
|
50 |
+
$ch = curl_init();
|
51 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
52 |
+
curl_setopt($ch, CURLOPT_VERBOSE, 0);
|
53 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
54 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: multipart/form-data"));
|
55 |
+
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0Mozilla/4.0 (compatible;)");
|
56 |
+
curl_setopt($ch, CURLOPT_URL, 'http://dineshkarki.com.np/font-convertor/eot.php');
|
57 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
58 |
+
$post = array(
|
59 |
+
'ttffile' => "@".$_FILES['font_file']['tmp_name'],
|
60 |
+
'api_key' => $uaf_api_key
|
61 |
+
);
|
62 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
63 |
+
$response = curl_exec($ch);
|
64 |
+
if(curl_errno($ch)) {
|
65 |
+
echo 'Error: ' . curl_error($ch);
|
66 |
+
exit();
|
67 |
+
}
|
68 |
+
else {
|
69 |
+
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
70 |
+
if ($http_code == 200) {
|
71 |
+
$newFileName = $fontNameToStore.'.eot';
|
72 |
+
$newFilePath = $upload_dir['path'].'/'.$newFileName;
|
73 |
+
$fh = fopen($newFilePath, 'w') or die("Can't open file");
|
74 |
+
fwrite($fh, $response);
|
75 |
+
fclose($fh);
|
76 |
+
} else {
|
77 |
+
echo $response;
|
78 |
+
exit();
|
79 |
+
}
|
80 |
+
}
|
81 |
+
endif;
|
82 |
+
$fontsRawData = get_option('uaf_font_data');
|
83 |
+
$fontsData = json_decode($fontsRawData, true);
|
84 |
+
if (empty($fontsData)):
|
85 |
+
$fontsData = array();
|
86 |
+
endif;
|
87 |
+
|
88 |
+
$fontsData[date('ymdhis')] = array('font_name' => $_POST['font_name'], 'font_path' => $fontNameToStoreWithUrl);
|
89 |
+
$updateFontData = json_encode($fontsData);
|
90 |
+
update_option('uaf_font_data',$updateFontData);
|
91 |
+
uaf_write_css();
|
92 |
+
$show_msg = 'Font Added';
|
93 |
+
}
|
94 |
+
|
95 |
+
if ($_GET['delete_font_key']):
|
96 |
+
$fontsRawData = get_option('uaf_font_data');
|
97 |
+
$fontsData = json_decode($fontsRawData, true);
|
98 |
+
$key_to_delete = $_GET['delete_font_key'];
|
99 |
+
@unlink(realpath($fontsData[$key_to_delete]['font_path'].'.woff'));
|
100 |
+
@unlink(realpath($fontsData[$key_to_delete]['font_path'].'.eot'));
|
101 |
+
unset($fontsData[$key_to_delete]);
|
102 |
+
$updateFontData = json_encode($fontsData);
|
103 |
+
update_option('uaf_font_data',$updateFontData);
|
104 |
+
$show_msg = 'Font Deleted';
|
105 |
+
uaf_write_css();
|
106 |
+
endif;
|
107 |
+
?>
|
108 |
+
|
109 |
+
<table class="wp-list-table widefat fixed bookmarks">
|
110 |
+
<thead>
|
111 |
+
<tr>
|
112 |
+
<th>Upload Fonts</th>
|
113 |
+
</tr>
|
114 |
+
</thead>
|
115 |
+
<tbody>
|
116 |
+
<tr>
|
117 |
+
<td>
|
118 |
+
|
119 |
+
<?php if (!empty($show_msg)):?>
|
120 |
+
<div class="updated" id="message"><p><?php echo $show_msg ?></p></div>
|
121 |
+
<?php endif; ?>
|
122 |
+
|
123 |
+
<?php
|
124 |
+
$fontsRawData = get_option('uaf_font_data');
|
125 |
+
$fontsData = json_decode($fontsRawData, true);
|
126 |
+
?>
|
127 |
+
|
128 |
+
<p align="right"><input type="button" name="open_add_font" onClick="open_add_font();" class="button-primary" value="Add Fonts" /><br/></p>
|
129 |
+
|
130 |
+
<div id="font-upload" style="display:none;">
|
131 |
+
<form action="options-general.php?page=use-any-font/plugin_interface.php" id="open_add_font_form" method="post" enctype="multipart/form-data">
|
132 |
+
<table class="uaf_form">
|
133 |
+
<tr>
|
134 |
+
<td width="175">Font Name</td>
|
135 |
+
<td><input type="text" name="font_name" value="" class="required" style="width:200px;" /></td>
|
136 |
+
</tr>
|
137 |
+
<tr>
|
138 |
+
<td>Font File</td>
|
139 |
+
<td><input type="file" name="font_file" value="" class="required" /></td>
|
140 |
+
</tr>
|
141 |
+
<tr>
|
142 |
+
<td>
|
143 |
+
|
144 |
+
</td>
|
145 |
+
<td><input type="submit" name="submit-uaf-font" class="button-primary" value="Upload" />
|
146 |
+
<p>By clicking on Upload, you confirm that you have rights to use this font.</p>
|
147 |
+
</td>
|
148 |
+
</tr>
|
149 |
+
</table>
|
150 |
+
</form>
|
151 |
+
<br/><br/>
|
152 |
+
</div>
|
153 |
+
|
154 |
+
<table cellspacing="0" class="wp-list-table widefat fixed bookmarks">
|
155 |
+
<thead>
|
156 |
+
<tr>
|
157 |
+
<th width="20">Sn</th>
|
158 |
+
<th>Font</th>
|
159 |
+
<th width="100">Delete</th>
|
160 |
+
</tr>
|
161 |
+
</thead>
|
162 |
+
|
163 |
+
<tbody>
|
164 |
+
<?php if (!empty($fontsData)): ?>
|
165 |
+
<?php
|
166 |
+
$sn = 0;
|
167 |
+
foreach ($fontsData as $key=>$fontData):
|
168 |
+
$sn++
|
169 |
+
?>
|
170 |
+
<tr>
|
171 |
+
<td><?php echo $sn; ?></td>
|
172 |
+
<td><?php echo $fontData['font_name'] ?></td>
|
173 |
+
<td><a onclick="if (!confirm('Are you sure ?')){return false;}" href="options-general.php?page=use-any-font/plugin_interface.php&delete_font_key=<?php echo $key; ?>">Delete</a></td>
|
174 |
+
</tr>
|
175 |
+
<?php endforeach; ?>
|
176 |
+
<?php else: ?>
|
177 |
+
<tr>
|
178 |
+
<td colspan="3">No font found. Please click on Add Fonts to add font</td>
|
179 |
+
</tr>
|
180 |
+
<?php endif; ?>
|
181 |
+
</tbody>
|
182 |
+
|
183 |
+
</table>
|
184 |
+
|
185 |
+
<script>
|
186 |
+
function open_add_font(){
|
187 |
+
jQuery('#font-upload').toggle('fast');
|
188 |
+
jQuery("#open_add_font_form").validate({
|
189 |
+
rules: {
|
190 |
+
font_name : {required:true, maxlength:40},
|
191 |
+
font_file : {required:true}
|
192 |
+
//accept:"ttf|otf|woff"
|
193 |
+
},
|
194 |
+
messages:{
|
195 |
+
//font_file : {accept:'Only accepts ttf,otf,woff'}
|
196 |
+
}
|
197 |
+
});
|
198 |
+
}
|
199 |
+
</script>
|
200 |
+
<br/>
|
201 |
+
</td>
|
202 |
+
</tr>
|
203 |
+
</tbody>
|
204 |
+
</table><br/>
|
includes/uaf_footer.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
</td>
|
2 |
+
<td width="15"> </td>
|
3 |
+
<td width="250" valign="top">
|
4 |
+
<table class="wp-list-table widefat fixed bookmarks">
|
5 |
+
<thead>
|
6 |
+
<tr>
|
7 |
+
<th>Support</th>
|
8 |
+
</tr>
|
9 |
+
</thead>
|
10 |
+
<tbody>
|
11 |
+
<tr>
|
12 |
+
<td>If you have any issues, click <a href="http://dineshkarki.com.np/forums/forum/use-any-fonts" target="_blank">here</a> to visit our support forum</td>
|
13 |
+
</tr>
|
14 |
+
</tbody>
|
15 |
+
</table>
|
16 |
+
<br/>
|
17 |
+
<table class="wp-list-table widefat fixed bookmarks">
|
18 |
+
<thead>
|
19 |
+
<tr>
|
20 |
+
<th>Plugins You May Like</th>
|
21 |
+
</tr>
|
22 |
+
</thead>
|
23 |
+
<tbody>
|
24 |
+
<tr>
|
25 |
+
<td>
|
26 |
+
<ol>
|
27 |
+
<li><a href="http://wordpress.org/extend/plugins/any-mobile-theme-switcher/" target="_blank">Any Mobile Theme Switcher</a></li>
|
28 |
+
<li><a href="http://wordpress.org/extend/plugins/add-tags-and-category-to-page/" target="_blank">Add Tags And Category To Page</a></li>
|
29 |
+
<li><a href="http://wordpress.org/extend/plugins/block-specific-plugin-updates/" target="_blank">Block Specific Plugin Updates</a></li>
|
30 |
+
<li><a href="http://wordpress.org/extend/plugins/featured-image-in-rss-feed/" target="_blank">Featured Image In RSS Feed</a></li>
|
31 |
+
<li><a href="http://wordpress.org/extend/plugins/remove-admin-bar-for-client/" target="_blank">Remove Admin Bar</a></li>
|
32 |
+
<li><a href="http://wordpress.org/extend/plugins/html-in-category-and-pages/" target="_blank">.html in category and page url</a></li>
|
33 |
+
</ol>
|
34 |
+
</td>
|
35 |
+
</tr>
|
36 |
+
</tbody>
|
37 |
+
</table>
|
38 |
+
<br/>
|
39 |
+
<table class="wp-list-table widefat fixed bookmarks">
|
40 |
+
<thead>
|
41 |
+
<tr>
|
42 |
+
<th>Facebook</th>
|
43 |
+
</tr>
|
44 |
+
</thead>
|
45 |
+
<tbody>
|
46 |
+
<tr>
|
47 |
+
<td><iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FDnessCarKey%2F77553779916&width=185&height=258&show_faces=true&colorscheme=light&stream=false&border_color=%23f9f9f9&header=false&appId=215419415167468" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:240px; height:150px;" allowTransparency="true"></iframe>
|
48 |
+
</td>
|
49 |
+
</tr>
|
50 |
+
</tbody>
|
51 |
+
</table>
|
52 |
+
<br/>
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
</table>
|
60 |
+
</div>
|
includes/uaf_header.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ($_POST['ucf_api_key_submit']){
|
3 |
+
$api_key_return = wp_remote_fopen('http://dineshkarki.com.np/license/validate_key.php?license_key='.$_POST['uaf_api_key']);
|
4 |
+
$api_key_return = json_decode($api_key_return);
|
5 |
+
if (!empty($api_key_return)){
|
6 |
+
if ($api_key_return->status == 'success'){
|
7 |
+
update_option('uaf_api_key', $_POST['uaf_api_key']);
|
8 |
+
}
|
9 |
+
$api_message = $api_key_return->msg;
|
10 |
+
} else {
|
11 |
+
$api_message = 'Sorry there was an error. Please try again.';
|
12 |
+
}
|
13 |
+
}
|
14 |
+
$uaf_api_key = get_option('uaf_api_key');
|
15 |
+
?>
|
16 |
+
<?php if (!empty($api_message)):?>
|
17 |
+
<div class="updated" id="message"><p><?php echo $api_message ?></p></div>
|
18 |
+
<?php endif; ?>
|
19 |
+
<div class="wrap">
|
20 |
+
<h2>Use Any Font</h2>
|
21 |
+
<table width="100%">
|
22 |
+
<tr>
|
23 |
+
<td valign="top">
|
24 |
+
<table class="wp-list-table widefat fixed bookmarks">
|
25 |
+
<thead>
|
26 |
+
<tr>
|
27 |
+
<th>API KEY</th>
|
28 |
+
</tr>
|
29 |
+
</thead>
|
30 |
+
<tbody>
|
31 |
+
<tr>
|
32 |
+
<td>
|
33 |
+
<form action="options-general.php?page=use-any-font/plugin_interface.php" method="post" >
|
34 |
+
API KEY :
|
35 |
+
<?php if (empty($uaf_api_key)): ?>
|
36 |
+
<input name="uaf_api_key" type="text" style="width:350px; margin-left:50px;" />
|
37 |
+
<input type="submit" name="ucf_api_key_submit" class="button-primary" value="Verify" style="padding:2px;" />
|
38 |
+
<br/> <br/>
|
39 |
+
Please keep the API key to start using this plugin. Offer your contribution (Free to $100) and get the API key from <a href="http://dineshkarki.com.np/license/" target="_blank">here</a>.<br/>
|
40 |
+
<?php else: ?>
|
41 |
+
<span class="active_key"><?php echo $uaf_api_key; ?> - Active</span>
|
42 |
+
<?php endif;?>
|
43 |
+
</form>
|
44 |
+
<br/>
|
45 |
+
<strong>Note</strong> : API key is need to connect to our server for font conversion. Our server converts your fonts to required types and sends it back.
|
46 |
+
<br/><br/>
|
47 |
+
</td>
|
48 |
+
|
49 |
+
</tr>
|
50 |
+
</tbody>
|
51 |
+
</table>
|
52 |
+
<br/>
|
js/jquery.uaf_validation.js
ADDED
@@ -0,0 +1,257 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($) {
|
2 |
+
|
3 |
+
$(function() {
|
4 |
+
try {
|
5 |
+
if (typeof _wpcf7 == 'undefined' || _wpcf7 === null)
|
6 |
+
_wpcf7 = {};
|
7 |
+
|
8 |
+
_wpcf7 = $.extend({ cached: 0 }, _wpcf7);
|
9 |
+
|
10 |
+
$('div.wpcf7 > form').ajaxForm({
|
11 |
+
beforeSubmit: function(formData, jqForm, options) {
|
12 |
+
jqForm.wpcf7ClearResponseOutput();
|
13 |
+
// CUSTOM CODE
|
14 |
+
$(jqForm).validate();
|
15 |
+
check_status = $('div.wpcf7 > form').valid();
|
16 |
+
if (check_status == true){
|
17 |
+
jqForm.find('img.ajax-loader').css({ visibility: 'visible' });
|
18 |
+
return true;
|
19 |
+
} else {
|
20 |
+
return false
|
21 |
+
}
|
22 |
+
// EOF CUSTOM CODE
|
23 |
+
|
24 |
+
jqForm.find('img.ajax-loader').css({ visibility: 'visible' });
|
25 |
+
return true;
|
26 |
+
|
27 |
+
},
|
28 |
+
beforeSerialize: function(jqForm, options) {
|
29 |
+
jqForm.find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
|
30 |
+
$(n).val('');
|
31 |
+
});
|
32 |
+
return true;
|
33 |
+
},
|
34 |
+
data: { '_wpcf7_is_ajax_call': 1 },
|
35 |
+
dataType: 'json',
|
36 |
+
success: function(data) {
|
37 |
+
var ro = $(data.into).find('div.wpcf7-response-output');
|
38 |
+
$(data.into).wpcf7ClearResponseOutput();
|
39 |
+
|
40 |
+
$(data.into).find('.wpcf7-form-control').removeClass('wpcf7-not-valid');
|
41 |
+
$(data.into).find('form.wpcf7-form').removeClass('invalid spam sent failed');
|
42 |
+
|
43 |
+
if (data.captcha)
|
44 |
+
$(data.into).wpcf7RefillCaptcha(data.captcha);
|
45 |
+
|
46 |
+
if (data.quiz)
|
47 |
+
$(data.into).wpcf7RefillQuiz(data.quiz);
|
48 |
+
|
49 |
+
if (data.invalids) {
|
50 |
+
$.each(data.invalids, function(i, n) {
|
51 |
+
$(data.into).find(n.into).wpcf7NotValidTip(n.message);
|
52 |
+
$(data.into).find(n.into).find('.wpcf7-form-control').addClass('wpcf7-not-valid');
|
53 |
+
});
|
54 |
+
|
55 |
+
ro.addClass('wpcf7-validation-errors');
|
56 |
+
$(data.into).find('form.wpcf7-form').addClass('invalid');
|
57 |
+
|
58 |
+
$(data.into).trigger('invalid.wpcf7');
|
59 |
+
|
60 |
+
} else if (1 == data.spam) {
|
61 |
+
ro.addClass('wpcf7-spam-blocked');
|
62 |
+
$(data.into).find('form.wpcf7-form').addClass('spam');
|
63 |
+
|
64 |
+
$(data.into).trigger('spam.wpcf7');
|
65 |
+
|
66 |
+
} else if (1 == data.mailSent) {
|
67 |
+
ro.addClass('wpcf7-mail-sent-ok');
|
68 |
+
$(data.into).find('form.wpcf7-form').addClass('sent');
|
69 |
+
|
70 |
+
if (data.onSentOk)
|
71 |
+
$.each(data.onSentOk, function(i, n) { eval(n) });
|
72 |
+
|
73 |
+
$(data.into).trigger('mailsent.wpcf7');
|
74 |
+
|
75 |
+
} else {
|
76 |
+
ro.addClass('wpcf7-mail-sent-ng');
|
77 |
+
$(data.into).find('form.wpcf7-form').addClass('failed');
|
78 |
+
|
79 |
+
$(data.into).trigger('mailfailed.wpcf7');
|
80 |
+
}
|
81 |
+
|
82 |
+
if (data.onSubmit)
|
83 |
+
$.each(data.onSubmit, function(i, n) { eval(n) });
|
84 |
+
|
85 |
+
$(data.into).trigger('submit.wpcf7');
|
86 |
+
|
87 |
+
if (1 == data.mailSent)
|
88 |
+
$(data.into).find('form').resetForm().clearForm();
|
89 |
+
|
90 |
+
$(data.into).find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
|
91 |
+
$(n).val($(n).attr('title'));
|
92 |
+
});
|
93 |
+
|
94 |
+
$(data.into).wpcf7FillResponseOutput(data.message);
|
95 |
+
}
|
96 |
+
});
|
97 |
+
|
98 |
+
$('div.wpcf7 > form').each(function(i, n) {
|
99 |
+
if (_wpcf7.cached)
|
100 |
+
$(n).wpcf7OnloadRefill();
|
101 |
+
|
102 |
+
$(n).wpcf7ToggleSubmit();
|
103 |
+
|
104 |
+
$(n).find('.wpcf7-submit').wpcf7AjaxLoader();
|
105 |
+
|
106 |
+
$(n).find('.wpcf7-acceptance').click(function() {
|
107 |
+
$(n).wpcf7ToggleSubmit();
|
108 |
+
});
|
109 |
+
|
110 |
+
$(n).find('.wpcf7-exclusive-checkbox').each(function(i, n) {
|
111 |
+
$(n).find('input:checkbox').click(function() {
|
112 |
+
$(n).find('input:checkbox').not(this).removeAttr('checked');
|
113 |
+
});
|
114 |
+
});
|
115 |
+
|
116 |
+
$(n).find('.wpcf7-use-title-as-watermark').each(function(i, n) {
|
117 |
+
var input = $(n);
|
118 |
+
input.val(input.attr('title'));
|
119 |
+
input.addClass('watermark');
|
120 |
+
|
121 |
+
input.focus(function() {
|
122 |
+
if ($(this).hasClass('watermark'))
|
123 |
+
$(this).val('').removeClass('watermark');
|
124 |
+
});
|
125 |
+
|
126 |
+
input.blur(function() {
|
127 |
+
if ('' == $(this).val())
|
128 |
+
$(this).val($(this).attr('title')).addClass('watermark');
|
129 |
+
});
|
130 |
+
});
|
131 |
+
});
|
132 |
+
|
133 |
+
} catch (e) {
|
134 |
+
}
|
135 |
+
});
|
136 |
+
|
137 |
+
$.fn.wpcf7AjaxLoader = function() {
|
138 |
+
return this.each(function() {
|
139 |
+
var loader = $('<img class="ajax-loader" />')
|
140 |
+
.attr({ src: _wpcf7.loaderUrl, alt: _wpcf7.sending })
|
141 |
+
.css('visibility', 'hidden');
|
142 |
+
|
143 |
+
$(this).after(loader);
|
144 |
+
});
|
145 |
+
};
|
146 |
+
|
147 |
+
$.fn.wpcf7ToggleSubmit = function() {
|
148 |
+
return this.each(function() {
|
149 |
+
var form = $(this);
|
150 |
+
if (this.tagName.toLowerCase() != 'form')
|
151 |
+
form = $(this).find('form').first();
|
152 |
+
|
153 |
+
if (form.hasClass('wpcf7-acceptance-as-validation'))
|
154 |
+
return;
|
155 |
+
|
156 |
+
var submit = form.find('input:submit');
|
157 |
+
if (! submit.length) return;
|
158 |
+
|
159 |
+
var acceptances = form.find('input:checkbox.wpcf7-acceptance');
|
160 |
+
if (! acceptances.length) return;
|
161 |
+
|
162 |
+
submit.removeAttr('disabled');
|
163 |
+
acceptances.each(function(i, n) {
|
164 |
+
n = $(n);
|
165 |
+
if (n.hasClass('wpcf7-invert') && n.is(':checked')
|
166 |
+
|| ! n.hasClass('wpcf7-invert') && ! n.is(':checked'))
|
167 |
+
submit.attr('disabled', 'disabled');
|
168 |
+
});
|
169 |
+
});
|
170 |
+
};
|
171 |
+
|
172 |
+
$.fn.wpcf7NotValidTip = function(message) {
|
173 |
+
return this.each(function() {
|
174 |
+
var into = $(this);
|
175 |
+
into.append('<span class="wpcf7-not-valid-tip">' + message + '</span>');
|
176 |
+
$('span.wpcf7-not-valid-tip').mouseover(function() {
|
177 |
+
$(this).fadeOut('fast');
|
178 |
+
});
|
179 |
+
into.find(':input').mouseover(function() {
|
180 |
+
into.find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
|
181 |
+
});
|
182 |
+
into.find(':input').focus(function() {
|
183 |
+
into.find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
|
184 |
+
});
|
185 |
+
});
|
186 |
+
};
|
187 |
+
|
188 |
+
$.fn.wpcf7OnloadRefill = function() {
|
189 |
+
return this.each(function() {
|
190 |
+
var url = $(this).attr('action');
|
191 |
+
if (0 < url.indexOf('#'))
|
192 |
+
url = url.substr(0, url.indexOf('#'));
|
193 |
+
|
194 |
+
var id = $(this).find('input[name="_wpcf7"]').val();
|
195 |
+
var unitTag = $(this).find('input[name="_wpcf7_unit_tag"]').val();
|
196 |
+
|
197 |
+
$.getJSON(url,
|
198 |
+
{ _wpcf7_is_ajax_call: 1, _wpcf7: id },
|
199 |
+
function(data) {
|
200 |
+
if (data && data.captcha)
|
201 |
+
$('#' + unitTag).wpcf7RefillCaptcha(data.captcha);
|
202 |
+
|
203 |
+
if (data && data.quiz)
|
204 |
+
$('#' + unitTag).wpcf7RefillQuiz(data.quiz);
|
205 |
+
}
|
206 |
+
);
|
207 |
+
});
|
208 |
+
};
|
209 |
+
|
210 |
+
$.fn.wpcf7RefillCaptcha = function(captcha) {
|
211 |
+
return this.each(function() {
|
212 |
+
var form = $(this);
|
213 |
+
|
214 |
+
$.each(captcha, function(i, n) {
|
215 |
+
form.find(':input[name="' + i + '"]').clearFields();
|
216 |
+
form.find('img.wpcf7-captcha-' + i).attr('src', n);
|
217 |
+
var match = /([0-9]+)\.(png|gif|jpeg)$/.exec(n);
|
218 |
+
form.find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[1]);
|
219 |
+
});
|
220 |
+
});
|
221 |
+
};
|
222 |
+
|
223 |
+
$.fn.wpcf7RefillQuiz = function(quiz) {
|
224 |
+
return this.each(function() {
|
225 |
+
var form = $(this);
|
226 |
+
|
227 |
+
$.each(quiz, function(i, n) {
|
228 |
+
form.find(':input[name="' + i + '"]').clearFields();
|
229 |
+
form.find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[0]);
|
230 |
+
form.find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[1]);
|
231 |
+
});
|
232 |
+
});
|
233 |
+
};
|
234 |
+
|
235 |
+
$.fn.wpcf7ClearResponseOutput = function() {
|
236 |
+
return this.each(function() {
|
237 |
+
$(this).find('div.wpcf7-response-output').hide().empty().removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked');
|
238 |
+
$(this).find('span.wpcf7-not-valid-tip').remove();
|
239 |
+
$(this).find('img.ajax-loader').css({ visibility: 'hidden' });
|
240 |
+
});
|
241 |
+
};
|
242 |
+
|
243 |
+
$.fn.wpcf7FillResponseOutput = function(message) {
|
244 |
+
return this.each(function() {
|
245 |
+
$(this).find('div.wpcf7-response-output').append(message).slideDown('fast');
|
246 |
+
});
|
247 |
+
};
|
248 |
+
|
249 |
+
})(jQuery);
|
250 |
+
|
251 |
+
jQuery(document).ready(function(){
|
252 |
+
jQuery('.wpcf7-validates-as-required').addClass('required');
|
253 |
+
jQuery('.wpcf7-email').addClass('email');
|
254 |
+
jQuery('form.wpcf7-form"').each(function(){
|
255 |
+
jQuery(this).validate();
|
256 |
+
});
|
257 |
+
});
|
js/jquery.validate.min.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery Validation Plugin - v1.10.0 - 9/7/2012
|
2 |
+
* https://github.com/jzaefferer/jquery-validation
|
3 |
+
* Copyright (c) 2012 Jörn Zaefferer; Licensed MIT, GPL */
|
4 |
+
(function(a){a.extend(a.fn,{validate:function(b){if(!this.length){b&&b.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return}var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.validateDelegate(":submit","click",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(b.target).hasClass("cancel")&&(c.cancelSubmit=!0)}),this.submit(function(b){function d(){var d;return c.settings.submitHandler?(c.submitButton&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(c.submitButton.value).appendTo(c.currentForm)),c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){if(a(this[0]).is("form"))return this.validate().form();var b=!0,c=a(this[0].form).validate();return this.each(function(){b&=c.element(this)}),b},removeAttrs:function(b){var c={},d=this;return a.each(b.split(/\s/),function(a,b){c[b]=d.attr(b),d.removeAttr(b)}),c},rules:function(b,c){var d=this[0];if(b){var e=a.data(d.form,"validator").settings,f=e.rules,g=a.validator.staticRules(d);switch(b){case"add":a.extend(g,a.validator.normalizeRule(c)),f[d.name]=g,c.messages&&(e.messages[d.name]=a.extend(e.messages[d.name],c.messages));break;case"remove":if(!c)return delete f[d.name],g;var h={};return a.each(c.split(/\s/),function(a,b){h[b]=g[b],delete g[b]}),h}}var i=a.validator.normalizeRules(a.extend({},a.validator.metadataRules(d),a.validator.classRules(d),a.validator.attributeRules(d),a.validator.staticRules(d)),d);if(i.required){var j=i.required;delete i.required,i=a.extend({required:j},i)}return i}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+b.value)},filled:function(b){return!!a.trim(""+b.value)},unchecked:function(a){return!a.checked}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return arguments.length===1?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),c)}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a,b){this.lastActive=a,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(a)).hide())},onfocusout:function(a,b){!this.checkable(a)&&(a.name in this.submitted||!this.optional(a))&&this.element(a)},onkeyup:function(a,b){if(b.which===9&&this.elementValue(a)==="")return;(a.name in this.submitted||a===this.lastActive)&&this.element(a)},onclick:function(a,b){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){b.type==="radio"?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){b.type==="radio"?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function d(b){var c=a.data(this[0].form,"validator"),d="on"+b.type.replace(/^validate/,"");c.settings[d]&&c.settings[d].call(c,this[0],b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var b=this.groups={};a.each(this.settings.groups,function(c,d){a.each(d.split(/\s/),function(a,d){b[d]=c})});var c=this.settings.rules;a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",d).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",d),this.settings.invalidHandler&&a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){b=this.validationTargetFor(this.clean(b)),this.lastElement=b,this.prepareElement(b),this.currentElements=a(b);var c=this.check(b)!==!1;return c?delete this.invalid[b.name]:this.invalid[b.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),c},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0;for(var c in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()===0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&a.grep(this.errorList,function(a){return a.element.name===b.name}).length===1&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.replace(" ",".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c=a(b).attr("type"),d=a(b).val();return c==="radio"||c==="checkbox"?a('input[name="'+a(b).attr("name")+'"]:checked').val():typeof d=="string"?d.replace(/\r/g,""):d},check:function(b){b=this.validationTargetFor(this.clean(b));var c=a(b).rules(),d=!1,e=this.elementValue(b),f;for(var g in c){var h={method:g,parameters:c[g]};try{f=a.validator.methods[g].call(this,e,b,h.parameters);if(f==="dependency-mismatch"){d=!0;continue}d=!1;if(f==="pending"){this.toHide=this.toHide.not(this.errorsFor(b));return}if(!f)return this.formatAndAdd(b,h),!1}catch(i){throw this.settings.debug&&window.console&&console.log("exception occured when checking element "+b.id+", check the '"+h.method+"' method",i),i}}if(d)return;return this.objectLength(c)&&this.successList.push(b),!0},customMetaMessage:function(b,c){if(!a.metadata)return;var d=this.settings.meta?a(b).metadata()[this.settings.meta]:a(b).metadata();return d&&d.messages&&d.messages[c]},customDataMessage:function(b,c){return a(b).data("msg-"+c.toLowerCase())||b.attributes&&a(b).attr("data-msg-"+c.toLowerCase())},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==undefined)return arguments[a];return undefined},defaultMessage:function(b,c){return this.findDefined(this.customMessage(b.name,c),this.customDataMessage(b,c),this.customMetaMessage(b,c),!this.settings.ignoreTitle&&b.title||undefined,a.validator.messages[c],"<strong>Warning: No message defined for "+b.name+"</strong>")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;typeof d=="function"?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b;for(a=0;this.errorList[a];a++){var c=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message)}this.errorList.length&&(this.toShow=this.toShow.add(this.containers));if(this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d=this.errorsFor(b);d.length?(d.removeClass(this.settings.validClass).addClass(this.settings.errorClass),d.attr("generated")&&d.html(c)):(d=a("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(b),generated:!0}).addClass(this.settings.errorClass).html(c||""),this.settings.wrapper&&(d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b))),!c&&this.settings.success&&(d.text(""),typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d,b)),this.toShow=this.toShow.add(d)},errorsFor:function(b){var c=this.idOrName(b);return this.errors().filter(function(){return a(this).attr("for")===c})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(a){return this.checkable(a)&&(a=this.findByName(a.name).not(this.settings.ignore)[0]),a},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find('[name="'+b+'"]')},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a,b){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&this.pendingRequest===0&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&this.pendingRequest===0&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},attributeRules:function(b){var c={},d=a(b);for(var e in a.validator.methods){var f;e==="required"?(f=d.get(0).getAttribute(e),f===""&&(f=!0),f=!!f):f=d.attr(e),f?c[e]=f:d[0].getAttribute("type")===e&&(c[e]=!0)}return c.maxlength&&/-1|2147483647|524288/.test(c.maxlength)&&delete c.maxlength,c},metadataRules:function(b){if(!a.metadata)return{};var c=a.data(b.form,"validator").settings.meta;return c?a(b).metadata()[c]:a(b).metadata()},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1){delete b[d];return}if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=e.param!==undefined?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength","min","max"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){b[this]&&(b[this]=[Number(b[this][0]),Number(b[this][1])])}),a.validator.autoCreateRanges&&(b.min&&b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),b.minlength&&b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b.messages&&delete b.messages,b},normalizeRule:function(b){if(typeof b=="string"){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=d!==undefined?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if(c.nodeName.toLowerCase()==="select"){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:a.trim(b).length>0},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e=this.previousValue(c);this.settings.messages[c.name]||(this.settings.messages[c.name]={}),e.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=e.message,d=typeof d=="string"&&{url:d}||d;if(this.pending[c.name])return"pending";if(e.old===b)return e.valid;e.old=b;var f=this;this.startRequest(c);var g={};return g[c.name]=b,a.ajax(a.extend(!0,{url:d,mode:"abort",port:"validate"+c.name,dataType:"json",data:g,success:function(d){f.settings.messages[c.name].remote=e.originalMessage;var g=d===!0||d==="true";if(g){var h=f.formSubmitted;f.prepareElement(c),f.formSubmitted=h,f.successList.push(c),delete f.invalid[c.name],f.showErrors()}else{var i={},j=d||f.defaultMessage(c,"remote");i[c.name]=e.message=a.isFunction(j)?j(b):j,f.invalid[c.name]=!0,f.showErrors(i)}e.valid=g,f.stopRequest(c,g)}},d)),"pending"},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(a.trim(b),c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(a.trim(b),c);return this.optional(c)||e<=d},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(a.trim(b),c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(a)},url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c=0,d=0,e=!1;a=a.replace(/\D/g,"");for(var f=a.length-1;f>=0;f--){var g=a.charAt(f);d=parseInt(g,10),e&&(d*=2)>9&&(d-=9),c+=d,e=!e}return c%10===0},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()}}}),a.format=a.validator.format})(jQuery),function(a){var b={};if(a.ajaxPrefilter)a.ajaxPrefilter(function(a,c,d){var e=a.port;a.mode==="abort"&&(b[e]&&b[e].abort(),b[e]=d)});else{var c=a.ajax;a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return e==="abort"?(b[f]&&b[f].abort(),b[f]=c.apply(this,arguments)):c.apply(this,arguments)}}}(jQuery),function(a){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&a.each({focus:"focusin",blur:"focusout"},function(b,c){function d(b){return b=a.event.fix(b),b.type=c,a.event.handle.call(this,b)}a.event.special[c]={setup:function(){this.addEventListener(b,d,!0)},teardown:function(){this.removeEventListener(b,d,!0)},handler:function(b){var d=arguments;return d[0]=a.event.fix(b),d[0].type=c,a.event.handle.apply(this,d)}}}),a.extend(a.fn,{validateDelegate:function(b,c,d){return this.bind(c,function(c){var e=a(c.target);if(e.is(b))return d.apply(e,arguments)})}})}(jQuery)
|
plugin_interface.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
add_action('admin_menu', 'uaf_create_menu');
|
3 |
+
add_action("admin_print_scripts", 'adminjslibs');
|
4 |
+
add_action("admin_print_styles", 'adminCsslibs');
|
5 |
+
add_action('wp_enqueue_scripts', 'uaf_client_css');
|
6 |
+
|
7 |
+
function uaf_client_css() {
|
8 |
+
wp_register_style( 'uaf_client_css', plugins_url('use-any-font/css/uaf.css'));
|
9 |
+
wp_enqueue_style( 'uaf_client_css' );
|
10 |
+
}
|
11 |
+
|
12 |
+
function adminjslibs(){
|
13 |
+
wp_register_script('uaf_validate_js',plugins_url("use-any-font/js/jquery.validate.min.js"));
|
14 |
+
wp_enqueue_script('uaf_validate_js');
|
15 |
+
}
|
16 |
+
|
17 |
+
function adminCsslibs(){
|
18 |
+
wp_register_style('uaf-admin-style', plugins_url('use-any-font/css/uaf_admin.css'));
|
19 |
+
wp_enqueue_style('uaf-admin-style');
|
20 |
+
}
|
21 |
+
|
22 |
+
function uaf_create_menu() {
|
23 |
+
add_options_page('Use Any Font', 'Use Any Font', 'administrator', __FILE__, 'uaf_settings_page');
|
24 |
+
}
|
25 |
+
|
26 |
+
function uaf_settings_page() {
|
27 |
+
include('includes/uaf_header.php');
|
28 |
+
include('includes/uaf_font_upload.php');
|
29 |
+
include('includes/uaf_font_implement.php');
|
30 |
+
include('includes/uaf_footer.php');
|
31 |
+
}
|
32 |
+
|
33 |
+
function uaf_write_css(){
|
34 |
+
ob_start();
|
35 |
+
$fontsRawData = get_option('uaf_font_data');
|
36 |
+
$fontsData = json_decode($fontsRawData, true);
|
37 |
+
if (!empty($fontsData)):
|
38 |
+
foreach ($fontsData as $key=>$fontData): ?>
|
39 |
+
@font-face {
|
40 |
+
font-family: '<?php echo $fontData['font_name'] ?>';
|
41 |
+
font-style: normal;
|
42 |
+
src: url(<?php echo $fontData['font_path'] ?>.eot);
|
43 |
+
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');
|
44 |
+
}
|
45 |
+
<?php
|
46 |
+
endforeach;
|
47 |
+
endif;
|
48 |
+
|
49 |
+
$fontsImplementRawData = get_option('uaf_font_implement');
|
50 |
+
$fontsImplementData = json_decode($fontsImplementRawData, true);
|
51 |
+
if (!empty($fontsImplementData)):
|
52 |
+
foreach ($fontsImplementData as $key=>$fontImplementData): ?>
|
53 |
+
<?php echo $fontImplementData['font_elements']; ?>{
|
54 |
+
font-family: '<?php echo $fontsData[$fontImplementData['font_key']]['font_name']; ?>' !important;
|
55 |
+
}
|
56 |
+
<?php
|
57 |
+
endforeach;
|
58 |
+
endif;
|
59 |
+
$uaf_style = ob_get_contents();
|
60 |
+
$uafStyleSheetPath = realpath('../wp-content/plugins/use-any-font/css/uaf.css');
|
61 |
+
$fh = fopen($uafStyleSheetPath, 'w') or die("Can't open file");
|
62 |
+
fwrite($fh, $uaf_style);
|
63 |
+
fclose($fh);
|
64 |
+
ob_end_clean();
|
65 |
+
}
|
66 |
+
?>
|
readme.txt
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Use Any Font ===
|
2 |
+
Contributors: dnesscarkey
|
3 |
+
Tags: use any font, any font, embed any font, font embed
|
4 |
+
Requires at least: 3.0.
|
5 |
+
Tested up to: 3.4.2
|
6 |
+
Stable tag: 1.0
|
7 |
+
|
8 |
+
Embed any font in your website
|
9 |
+
|
10 |
+
== Description ==
|
11 |
+
Use any font you wish and give your site a elegant look. No css knowledge required.
|
12 |
+
|
13 |
+
Click <a href="http://dineshkarki.com.np/use-any-font/demo" target="_blank">here</a> for Use Any Font working demo.
|
14 |
+
|
15 |
+
Features
|
16 |
+
|
17 |
+
* Quick and easy to setup. No css or any rocket science knowledge needed.
|
18 |
+
* Support all major browsers including IE 6+, Firefox, Chrome, Safari, IOS, Andriod, Opera and more.
|
19 |
+
* Font conversion within the plugin interface. You just need to upload ttf font, other required font types are generated automatically.
|
20 |
+
* Multiple fonts can be used.
|
21 |
+
* Faster load time as your fonts are stored on your own server.
|
22 |
+
* Quick font assign interface. You can select pre defined html tags or assign it to custom css.
|
23 |
+
* <a href="http://dineshkarki.com.np/forums/forum/use-any-fonts" target="_blank">Support Forum</a> to quickly resolve your issues.
|
24 |
+
|
25 |
+
You need API key to connect to our server for font conversion. Our server converts your font and sends it back.
|
26 |
+
|
27 |
+
Offer your contribution (Free to $100) and get the API key from <a href="http://dineshkarki.com.np/license/" target="_blank">here</a>.
|
28 |
+
|
29 |
+
Note : We don't store your fonts in our server neither any of your information except the API key details. Our server deletes the temporary file after the conversion is done.
|
30 |
+
|
31 |
+
== Installation ==
|
32 |
+
|
33 |
+
1. Upload the plugin use-any-font files to the `/wp-content/plugins/` directory
|
34 |
+
1. Activate the use-any-font plugin through the 'Plugins' menu in WordPress.
|
35 |
+
1. Select Use Any Font under Settings
|
36 |
+
1. Upload your font.
|
37 |
+
1. Assign your font to element.
|
38 |
+
1. Your fonts are working in your site now.
|
39 |
+
|
40 |
+
== Frequently Asked Questions ==
|
41 |
+
|
42 |
+
= Does it works with multiple fonts ? =
|
43 |
+
|
44 |
+
Ya, it works with multiple fonts.
|
45 |
+
|
46 |
+
= Do i need to manually convert fonts ? =
|
47 |
+
|
48 |
+
No, you don't need to do it yourself. Just upload your font in tff font format, and the plugin does the rest.
|
49 |
+
|
50 |
+
== Screenshots ==
|
51 |
+
|
52 |
+
1. Use Any Font Demo
|
53 |
+
|
54 |
+
== Changelog ==
|
55 |
+
|
56 |
+
= 1.0 =
|
57 |
+
First Release
|
screenshot-1.png
ADDED
Binary file
|
use-any-font.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
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: 1.0
|
8 |
+
Author URI: http://www.dineshkarki.com.np
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Copyright 2012 Dinesh Karki (email : dnesskarki@gmail.com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License, version 2, as
|
15 |
+
published by the Free Software Foundation.
|
16 |
+
|
17 |
+
This program is distributed in the hope that it will be useful,
|
18 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
+
GNU General Public License for more details.
|
21 |
+
|
22 |
+
You should have received a copy of the GNU General Public License
|
23 |
+
along with this program; if not, write to the Free Software
|
24 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
+
*/
|
26 |
+
include('plugin_interface.php');
|
27 |
+
?>
|