Initial commit. State 04.2021.

This commit is contained in:
2021-04-22 17:57:16 +02:00
commit 82781cca41
2974 changed files with 975656 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
<?php
function uaf_mce_before_init( $init_array ) {
$theme_advanced_fonts = '';
$fontsRawData = get_option('uaf_font_data');
$fontsData = json_decode($fontsRawData, true);
if (!empty($fontsData)):
foreach ($fontsData as $key=>$fontData):
$theme_advanced_fonts .= ucfirst(str_replace('_',' ', $fontData['font_name'])) .'='.$fontData['font_name'].';';
endforeach;
endif;
$init_array['font_formats'] = $theme_advanced_fonts.'Andale Mono=Andale Mono, Times;Arial=Arial, Helvetica, sans-serif;Arial Black=Arial Black, Avant Garde;Book Antiqua=Book Antiqua, Palatino;Comic Sans MS=Comic Sans MS, sans-serif;Courier New=Courier New, Courier;Georgia=Georgia, Palatino;Helvetica=Helvetica;Impact=Impact, Chicago;Symbol=Symbol;Tahoma=Tahoma, Arial, Helvetica, sans-serif;Terminal=Terminal, Monaco;Times New Roman=Times New Roman, Times;Trebuchet MS=Trebuchet MS, Geneva;Verdana=Verdana, Geneva;Webdings=Webdings;Wingdings=Wingdings';
return $init_array;
}
function wp_editor_fontsize_filter( $options ) {
array_unshift( $options, 'fontsizeselect');
array_unshift( $options, 'fontselect');
return $options;
}

View File

@@ -0,0 +1,168 @@
<?php
if (isset($_POST['submit-uaf-implement'])){
$fontsImplementRawData = get_option('uaf_font_implement');
$fontsImplementData = json_decode($fontsImplementRawData, true);
if (empty($fontsImplementData)):
$fontsImplementData = array();
endif;
$fontElements = array();
$fontElements[] = @join(', ',$_POST['elements']);
$fontElements[] = @join(', ',array_filter(array_map('trim',explode("\n", trim($_POST['custom_elements'])))));
$fontElements = array_filter(array_map('trim',$fontElements));
$finalElements = join(', ', $fontElements);
if (!empty($finalElements)){
$fontsImplementData[date('ymdhis')] = array(
'font_key' => $_POST['font_key'],
'font_elements' => $finalElements
);
$updateFontsImplementData = json_encode($fontsImplementData);
update_option('uaf_font_implement',$updateFontsImplementData);
uaf_write_css();
$implementMsg = 'Font Assigned';
} else {
$implementMsg = "Couldn't assign font. Please select atleast one element or add a custom element";
}
}
if (isset($_GET['delete_implement_key'])):
$fontsImplementRawData = get_option('uaf_font_implement');
$fontsImplementData = json_decode($fontsImplementRawData, true);
$key_to_delete = $_GET['delete_implement_key'];
unset($fontsImplementData[$key_to_delete]);
$updateFontsImplementData = json_encode($fontsImplementData);
update_option('uaf_font_implement',$updateFontsImplementData);
uaf_write_css();
$implementMsg = 'Font assign removed';
endif;
?>
<table class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th>Assign Font</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php if (!empty($implementMsg)):?>
<div class="updated" id="message"><p><?php echo $implementMsg ?></p></div>
<?php endif; ?>
<?php
$fontsRawData = get_option('uaf_font_data');
$fontsData = json_decode($fontsRawData, true);
?>
<p align="right"><input type="button" name="open_assign_font" onClick="open_assign_font();" class="button-primary" value="Assign Font" /><br/></p>
<div id="open_assign_font" style="display:none;">
<form action="admin.php?page=uaf_settings_page" id="open_assign_font_form" method="post">
<table class="uaf_form">
<tr>
<td width="175">Select Font</td>
<td>
<select name="font_key" class="required" style="width:200px;">
<option value="">- Select -</option>
<?php
if (!empty($fontsData)):
foreach ($fontsData as $key=>$fontData) : ?>
<option value="<?php echo $key ?>"><?php echo $fontData['font_name']; ?></option>
<?php endforeach;
endif;
?>
</select>
</td>
</tr>
<tr>
<td valign="top">Select elements to assign</td>
<td>
<input name="elements[]" value="body" type="checkbox" /> All (body tags)<br/>
<input name="elements[]" value="h1" type="checkbox" /> Headline 1 (h1 tags)<br/>
<input name="elements[]" value="h2" type="checkbox" /> Headline 2 (h2 tags)<br/>
<input name="elements[]" value="h3" type="checkbox" /> Headline 3 (h3 tags)<br/>
<input name="elements[]" value="h4" type="checkbox" /> Headline 4 (h4 tags)<br/>
<input name="elements[]" value="h5" type="checkbox" /> Headline 5 (h5 tags)<br/>
<input name="elements[]" value="h6" type="checkbox" /> Headline 6 (h6 tags)<br/>
<input name="elements[]" value="p" type="checkbox" /> Paragraphs (p tags)<br/>
<input name="elements[]" value="blockquote" type="checkbox" /> Blockquotes<br/>
<input name="elements[]" value="li" type="checkbox" /> Lists (li tags)<br/>
<input name="elements[]" value="a" type="checkbox" /> Hyperlink (a tags)
</td>
</tr>
<tr>
<td valign="top">Custom Elements</td>
<td><textarea name="custom_elements" style="width:400px; height:150px;"></textarea><br/>
<br/>
<strong>Note</strong><br/>
Each line indicate one css element. You don't need to use any css.<br />
<strong>Example:</strong><br/>
<em>#content .wrap</em><br/>
<em>#content p </em>
<br/>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="submit-uaf-implement" class="button-primary" value="Assign Font" /></td>
</tr>
</table>
</form>
<br/><br/>
</div>
<?php
$fontsImplementRawData = get_option('uaf_font_implement');
$fontsImplementData = json_decode($fontsImplementRawData, true);
?>
<table cellspacing="0" class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th width="20">Sn</th>
<th>Font</th>
<th>Applied To</th>
<th width="100">Delete</th>
</tr>
</thead>
<tbody>
<?php if (!empty($fontsImplementData)): ?>
<?php
$sn = 0;
foreach ($fontsImplementData as $key=>$fontImplementData):
$sn++
?>
<tr>
<td><?php echo $sn; ?></td>
<td><?php echo $fontsData[$fontImplementData['font_key']]['font_name']; ?></td>
<td><?php echo $fontImplementData['font_elements'] ?></td>
<td><a onclick="if (!confirm('Are you sure ?')){return false;}" href="admin.php?page=uaf_settings_page&delete_implement_key=<?php echo $key; ?>">Delete</a></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="4">No font assign yet. Click on Assign Font to start.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<script>
function open_assign_font(){
jQuery('#open_assign_font').toggle('fast');
jQuery("#open_assign_font_form").validate();
}
</script>
<br/>
</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,247 @@
<?php
$allowedFontFormats = array ('ttf','otf','woff');
$uaf_api_key = get_option('uaf_api_key');
if (isset($_POST['submit-uaf-font'])){
$fontUploadFinalMsg = '';
$fontUploadFinalStatus = 'updated';
if (!empty($_POST['font_name'])):
$fontNameToStore = sanitize_file_name(date('ymdhis').$_POST['font_name']);
$fontNameToStoreWithUrl = $fontNameToStore;
if (!empty($_POST['convert_response'])):
$convertResponseArray = json_decode(stripslashes($_POST['convert_response']), true);
if ($convertResponseArray['global']['status'] == 'ok'):
$neededFontFormats = array('woff','eot');
foreach ($neededFontFormats as $neededFontFormat):
if ($convertResponseArray[$neededFontFormat]['status'] == 'ok'):
$fontFileContent = '';
$fontFileContent = wp_remote_fopen($convertResponseArray[$neededFontFormat]['filename']);
if (!empty($fontFileContent)):
$newFileName = $fontNameToStore.'.'.$neededFontFormat;
$newFilePath = $uaf_upload_dir.$newFileName;
$fh = fopen($newFilePath, 'w') or die("can't open file. Make sure you have write permission to your upload folder");
fwrite($fh, $fontFileContent);
fclose($fh);
$fontUploadMsg[$neededFontFormat]['status'] = 'ok';
$fontUploadMsg[$neededFontFormat]['text'] = "Done";
else:
$fontUploadMsg[$neededFontFormat]['status'] = 'error';
$fontUploadMsg[$neededFontFormat]['text'] = "Couldn't receive $neededFontFormat file";
endif;
else:
$fontUploadMsg[$neededFontFormat]['status'] = 'error';
$fontUploadMsg[$neededFontFormat]['text'] = "Problem converting to $neededFontFormat format";
endif;
endforeach;
else:
$fontUploadFinalStatus = 'error';
$fontUploadFinalMsg .= $convertResponseArray['global']['msg'].'<br/>';
endif;
else:
$fontUploadFinalStatus = 'error';
$fontUploadFinalMsg = "Convert Response is Empty. Please try again enabling alternative uploader from Additional settings below.";
endif;
else:
$fontUploadFinalStatus = 'error';
$fontUploadFinalMsg = "Font Name is empty";
endif;
if (!empty($fontUploadMsg)):
foreach ($fontUploadMsg as $formatKey => $formatData):
if ($formatData['status'] == 'error'):
$fontUploadFinalStatus = 'error';
$fontUploadFinalMsg .= $formatData['text'].'<br/>';
endif;
endforeach;
endif;
if ($fontUploadFinalStatus != 'error'):
$fontUploadFinalMsg = 'Font Uploaded';
endif;
if ($fontUploadFinalStatus != 'error'):
$fontsRawData = get_option('uaf_font_data');
$fontsData = json_decode($fontsRawData, true);
if (empty($fontsData)):
$fontsData = array();
endif;
$fontsData[date('ymdhis')] = array('font_name' => sanitize_title($_POST['font_name']), 'font_path' => $fontNameToStoreWithUrl);
$updateFontData = json_encode($fontsData);
update_option('uaf_font_data',$updateFontData);
uaf_write_css();
endif;
}
if (isset($_GET['delete_font_key'])):
$fontsRawData = get_option('uaf_font_data');
$fontsData = json_decode($fontsRawData, true);
$key_to_delete = $_GET['delete_font_key'];
@unlink(realpath($uaf_upload_dir.$fontsData[$key_to_delete]['font_path'].'.woff'));
@unlink(realpath($uaf_upload_dir.$fontsData[$key_to_delete]['font_path'].'.eot'));
unset($fontsData[$key_to_delete]);
$updateFontData = json_encode($fontsData);
update_option('uaf_font_data',$updateFontData);
$fontUploadFinalStatus = 'updated';
$fontUploadFinalMsg = 'Font Deleted';
uaf_write_css();
endif;
?>
<table class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th>Upload Fonts</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php if (!empty($fontUploadFinalMsg)):?>
<div class="<?php echo $fontUploadFinalStatus; ?>" id="message"><p><?php echo $fontUploadFinalMsg ?></p></div>
<?php endif; ?>
<?php
$fontsRawData = get_option('uaf_font_data');
$fontsData = json_decode($fontsRawData, true);
?>
<p align="right"><input type="button" name="open_add_font" onClick="open_add_font();" class="button-primary" value="Add Fonts" /><br/></p>
<div id="font-upload" style="display:none;">
<form action="admin.php?page=uaf_settings_page" id="open_add_font_form" method="post" enctype="multipart/form-data">
<table class="uaf_form">
<tr>
<td width="175">Font Name</td>
<td><input type="text" name="font_name" value="" maxlength="20" class="required" style="width:200px;" /></td>
</tr>
<tr>
<td>Font File</td>
<td><input type="file" id="fontfile" name="fontfile" value="" class="required" /><br/>
<?php
?>
<em>Accepted Font Format : <?php echo join(", ",$allowedFontFormats); ?> | Font Size: Upto 15 MB</em><br/>
</td>
</tr>
<tr>
<td>&nbsp;
</td>
<td>
<input type="hidden" name="api_key" value="<?php echo $uaf_api_key; ?>" />
<input type="hidden" name="convert_response" id="convert_response" value="" />
<input type="submit" name="submit-uaf-font" id="submit-uaf-font" class="button-primary" value="Upload" />
<div id="font_upload_message" class=""></div>
<p>By clicking on Upload, you confirm that you have rights to use this font.</p>
</td>
</tr>
</table>
</form>
<br/><br/>
</div>
<table cellspacing="0" class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th width="20">Sn</th>
<th>Font</th>
<th width="100">Delete</th>
</tr>
</thead>
<tbody>
<?php if (!empty($fontsData)): ?>
<?php
$sn = 0;
foreach ($fontsData as $key=>$fontData):
$sn++
?>
<tr>
<td><?php echo $sn; ?></td>
<td><?php echo $fontData['font_name'] ?></td>
<td><a onclick="if (!confirm('Are you sure ?')){return false;}" href="admin.php?page=uaf_settings_page&delete_font_key=<?php echo $key; ?>">Delete</a></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="3">No font found. Please click on Add Fonts to add font</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<script>
function open_add_font(){
jQuery('#font-upload').toggle('fast');
jQuery("#open_add_font_form").validate();
jQuery( "#fontfile" ).rules( "add", {extension: 'ttf|otf|woff', messages: {extension : 'Only ttf,otf,woff font format accepted.' }});
}
</script>
<br/>
</td>
</tr>
</tbody>
</table>
<br/>
<script>
jQuery('#open_add_font_form')
.submit(function(e){
var $formValid = jQuery(this);
if(! $formValid.valid()) return false;
jQuery.ajax( {
url: 'https://nexus.websitewelcome.com/~dinesh/font-convertor/convertor/convert.php',
type: 'POST',
data: new FormData( this ),
processData: false,
contentType: false,
async: false,
beforeSend : function(){
jQuery('#submit-uaf-font').attr('disabled',true);
jQuery('#font_upload_message').attr('class','ok');
jQuery('#font_upload_message').html('Uploading Font. It might take few mins based on your font file size.');
},
success: function(data, textStatus, jqXHR)
{
var dataReturn = JSON.parse(data);
status = dataReturn.global.status;
msg = dataReturn.global.msg;
if (status == 'error'){
jQuery('#font_upload_message').attr('class',status);
jQuery('#font_upload_message').html(msg);
} else {
woffStatus = dataReturn.woff.status;
eotStatus = dataReturn.eot.status;
if (woffStatus == 'ok' && eotStatus == 'ok'){
woffFilePath = dataReturn.woff.filename;
eotFilePath = dataReturn.eot.filename;
jQuery('#convert_response').val(data);
jQuery('#font_upload_message').attr('class','ok');
jQuery('#font_upload_message').html('Font Conversion Complete. Finalizing...');
jQuery('#submit-uaf-font').attr('disabled',false);
jQuery('#fontfile').remove();
} else {
jQuery('#font_upload_message').attr('class','error');
jQuery('#font_upload_message').html('Problem converting font to woff/eot.');
e.preventDefault();
}
}
},
error: function(jqXHR, textStatus, errorThrown)
{
jQuery('#font_upload_message').attr('class','error');
jQuery('#font_upload_message').html('Unexpected Error Occured.');
jQuery('#submit-uaf-font').attr('disabled',false);
e.preventDefault();
}
});
// e.preventDefault();
});
</script>

View File

@@ -0,0 +1,218 @@
<?php
$allowedFontFormats = array ('ttf','otf','woff');
$allowedFontSize = 15;
$wpAllowedMaxSize = wp_max_upload_size();
$wpAllowedMaxSizeToMB = $wpAllowedMaxSize / 1048576 ;
if ($wpAllowedMaxSizeToMB < $allowedFontSize){
$allowedFontSize = $wpAllowedMaxSizeToMB;
}
$allowedFontSizeinBytes = $allowedFontSize * 1024 * 1024; // 10 MB to bytes
if (isset($_POST['submit-uaf-font'])){
$uaf_api_key = get_option('uaf_api_key');
$font_file_name = $_FILES['font_file']['name'];
$font_file_details = pathinfo($_FILES['font_file']['name']);
$file_extension = strtolower($font_file_details['extension']);
$font_size = $_FILES['font_file']['size'];
$fontUploadFinalMsg = '';
$fontUploadFinalStatus = 'updated';
if ((in_array($file_extension, $allowedFontFormats)) && ($font_size <= $allowedFontSizeinBytes)){
$fontNameToStore = sanitize_file_name(date('ymdhis').$font_file_details['filename']);
$fontNameToStoreWithUrl = $fontNameToStore;
// SEND FONT CONERSION REQUEST
set_time_limit(0);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'http://dnesscarkey.com/font-convertor/convertor/convert.php');
curl_setopt($ch, CURLOPT_POST, true);
$post = array(
'fontfile' => "@".$_FILES['font_file']['tmp_name'],
'fontfileext' => pathinfo($_FILES['font_file']['name'], PATHINFO_EXTENSION),
'api_key' => $uaf_api_key
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$convertResponse = curl_exec($ch);
if(curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
exit();
}
else {
$CrulStatinfo = curl_getinfo($ch);
if ($CrulStatinfo['http_code'] == '200'):
$convertResponseArray = json_decode($convertResponse, true);
if ($convertResponseArray['global']['status'] == 'ok'):
$neededFontFormats = array('woff','eot');
foreach ($neededFontFormats as $neededFontFormat):
if ($convertResponseArray[$neededFontFormat]['status'] == 'ok'):
$fontFileContent = '';
$fontFileContent = wp_remote_fopen($convertResponseArray[$neededFontFormat]['filename']);
if (!empty($fontFileContent)):
$newFileName = $fontNameToStore.'.'.$neededFontFormat;
$newFilePath = $uaf_upload_dir.$newFileName;
$fh = fopen($newFilePath, 'w') or die("can't open file. Make sure you have write permission to your upload folder");
fwrite($fh, $fontFileContent);
fclose($fh);
$fontUploadMsg[$neededFontFormat]['status'] = 'ok';
$fontUploadMsg[$neededFontFormat]['text'] = "Done";
else:
$fontUploadMsg[$neededFontFormat]['status'] = 'error';
$fontUploadMsg[$neededFontFormat]['text'] = "Couldn't receive $neededFontFormat file";
endif;
else:
$fontUploadMsg[$neededFontFormat]['status'] = 'error';
$fontUploadMsg[$neededFontFormat]['text'] = "Problem converting to $neededFontFormat format";
endif;
endforeach;
else:
$fontUploadFinalStatus = 'error';
$fontUploadFinalMsg .= $convertResponseArray['global']['msg'].'<br/>';
endif;
else:
$fontUploadFinalStatus = 'error';
$fontUploadFinalMsg = $convertResponse;
endif;
}
if (!empty($fontUploadMsg)):
foreach ($fontUploadMsg as $formatKey => $formatData):
if ($formatData['status'] == 'error'):
$fontUploadFinalStatus = 'error';
$fontUploadFinalMsg .= $formatData['text'].'<br/>';
endif;
endforeach;
endif;
if ($fontUploadFinalStatus != 'error'):
$fontUploadFinalMsg = 'Font Uploaded';
endif;
if ($fontUploadFinalStatus != 'error'):
$fontsRawData = get_option('uaf_font_data');
$fontsData = json_decode($fontsRawData, true);
if (empty($fontsData)):
$fontsData = array();
endif;
$fontsData[date('ymdhis')] = array('font_name' => sanitize_title($_POST['font_name']), 'font_path' => $fontNameToStoreWithUrl);
$updateFontData = json_encode($fontsData);
update_option('uaf_font_data',$updateFontData);
uaf_write_css();
endif;
} else {
$fontUploadFinalStatus = 'error';
$fontUploadFinalMsg = 'Only '.join(", ",$allowedFontFormats).' format and font less than '.$allowedFontSize.' Mb accepted';
}
}
if (isset($_GET['delete_font_key'])):
$fontsRawData = get_option('uaf_font_data');
$fontsData = json_decode($fontsRawData, true);
$key_to_delete = $_GET['delete_font_key'];
@unlink(realpath($uaf_upload_dir.$fontsData[$key_to_delete]['font_path'].'.woff'));
@unlink(realpath($uaf_upload_dir.$fontsData[$key_to_delete]['font_path'].'.eot'));
unset($fontsData[$key_to_delete]);
$updateFontData = json_encode($fontsData);
update_option('uaf_font_data',$updateFontData);
$fontUploadFinalStatus = 'updated';
$fontUploadFinalMsg = 'Font Deleted';
uaf_write_css();
endif;
?>
<table class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th>Upload Fonts</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php if (!empty($fontUploadFinalMsg)):?>
<div class="<?php echo $fontUploadFinalStatus; ?>" id="message"><p><?php echo $fontUploadFinalMsg ?></p></div>
<?php endif; ?>
<?php
$fontsRawData = get_option('uaf_font_data');
$fontsData = json_decode($fontsRawData, true);
?>
<p align="right"><input type="button" name="open_add_font" onClick="open_add_font();" class="button-primary" value="Add Fonts" /><br/></p>
<div id="font-upload" style="display:none;">
<form action="admin.php?page=uaf_settings_page" id="open_add_font_form" method="post" enctype="multipart/form-data">
<table class="uaf_form">
<tr>
<td width="175">Font Name</td>
<td><input type="text" name="font_name" value="" maxlength="20" class="required" style="width:200px;" /></td>
</tr>
<tr>
<td>Font File</td>
<td><input type="file" name="font_file" id="font_file" value="" class="required" /><br/>
<?php
?>
<em>Accepted Font Format : <?php echo join(", ",$allowedFontFormats); ?> | Font Size: Upto <?php echo $allowedFontSize; ?>MB</em><br/>
</td>
</tr>
<tr>
<td>&nbsp;
</td>
<td><input type="submit" name="submit-uaf-font" class="button-primary" value="Upload" />
<p>By clicking on Upload, you confirm that you have rights to use this font.</p>
</td>
</tr>
</table>
</form>
<br/><br/>
</div>
<table cellspacing="0" class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th width="20">Sn</th>
<th>Font</th>
<th width="100">Delete</th>
</tr>
</thead>
<tbody>
<?php if (!empty($fontsData)): ?>
<?php
$sn = 0;
foreach ($fontsData as $key=>$fontData):
$sn++
?>
<tr>
<td><?php echo $sn; ?></td>
<td><?php echo $fontData['font_name'] ?></td>
<td><a onclick="if (!confirm('Are you sure ?')){return false;}" href="admin.php?page=uaf_settings_page&delete_font_key=<?php echo $key; ?>">Delete</a></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="3">No font found. Please click on Add Fonts to add font</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<script>
function open_add_font(){
jQuery('#font-upload').toggle('fast');
jQuery("#open_add_font_form").validate();
jQuery( "#font_file" ).rules( "add", {extension: 'ttf|otf|woff', messages: {extension : 'Only ttf,otf font format accepted.' }});
}
</script>
<br/>
</td>
</tr>
</tbody>
</table><br/>

View File

@@ -0,0 +1,231 @@
<?php
$server_status = get_option('uaf_server_status');
if (isset($_POST['test_server']) || empty($server_status)){
if (in_array ('curl', get_loaded_extensions())) {
$test_code = date('ymdhis');
$ch_test = curl_init();
curl_setopt($ch_test, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch_test, CURLOPT_URL, 'http://dnesscarkey.com/font-convertor/server/check.php');
curl_setopt($ch_test, CURLOPT_POST, true);
$post = array(
'test_code' => $test_code
);
curl_setopt($ch_test, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch_test);
if(curl_errno($ch_test)) {
$server_err_stat = 'test_error';
$server_err_msg = '<strong>Error</strong>: ' . curl_error($ch_test);
}
else {
$http_code = curl_getinfo($ch_test, CURLINFO_HTTP_CODE);
if ($http_code == 200) {
if ($test_code == $response){
$server_err_stat = 'test_successfull';
$server_err_msg = '';
} else {
$server_err_stat = 'test_error';
$server_err_msg = '<strong>Error</strong>: Sorry couldnot get response back from the server.';
}
} else {
$server_err_stat = 'test_error';
$server_err_msg = '<strong>Error</strong>: ' .$response;
}
}
} else {
$server_err_stat = 'test_error';
$server_err_msg = '<strong>Error</strong>: Curl not enabled in your server.';
}
update_option('uaf_server_status', $server_err_stat);
update_option('uaf_server_msg', $server_err_msg);
}
$server_status = get_option('uaf_server_status');
$server_message = get_option('uaf_server_msg');
?>
<?php if (!empty($settings_message)):?>
<div class="updated" id="message"><p><?php echo $settings_message ?></p></div>
<?php endif; ?>
<br/>
<table class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th>Additional Settings (Usually not required)</th>
</tr>
</thead>
<tbody>
<form method="post" action="">
<tr>
<td>
<input type="checkbox" name="uaf_disbale_editor_font_list" value="1" <?php echo $uaf_disbale_editor_font_list_value == 1?'checked=checked':''; ?> /> Disable Font list in wordpress editor.
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="uaf_use_curl_uploader" value="1" <?php echo $uaf_use_curl_uploader_value == 1?'checked=checked':''; ?> /> Use alternative uploader (Need PHP Curl).
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="uaf_use_relative_font_path" value="1" <?php echo $uaf_use_relative_font_path == 1?'checked=checked':''; ?> /> Use relative path for font (Needed when you have domain mapping).
</td>
</tr>
<tr>
<td><input type="submit" name="submit-uaf-settings" class="button-primary" value="Save Settings" /></td>
</tr>
</form>
</tbody>
</table>
<br/>
<table class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th>Instructions</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ol>
<li>Get API key from <a href="http://dnesscarkey.com/font-convertor/api/" target="_blank">here</a>. You can offer your contribution from (Free to $100) and get the API key. All API key comes with lifetime validity.<br/>
<em><strong>Note:</strong> API key is needed to connect to our server for font conversion.</em>
</li>
<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.
<em><strong>Note:</strong> We don't store any font in our server. We delete the temporary files after conversion has been done.</em>
</li>
<li>Assign your font to you html elements from <strong>Assign Font</strong> section.</li>
<li>You can also assign uploaded font directly from Post/Page Wordpress Editor.</li>
<li>If you are fond of visual instructions, you can check it <a href="http://dineshkarki.com.np/use-any-font/instructions" target="_blank">here</a>.</li>
<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>
</ol>
</td>
</tr>
</tbody>
</table>
</td>
<td width="15">&nbsp;</td>
<td width="250" valign="top">
<?php if ($uaf_use_curl_uploader_value == 1): ?>
<table class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th>Server Connectivity Test</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div id="server_status" class="<?php echo $server_status; ?>">
<?php echo str_replace('_',' ',$server_status); ?>
</div>
<?php if ($server_status == 'test_error'): ?>
<div class="uaf_test_msg"><?php echo $server_message; ?></div>
<?php endif; ?>
<form action="admin.php?page=uaf_settings_page" method="post">
<p align="center">
<input type="submit" value="Test Again" class="button-primary" name="test_server" />
</p>
</form>
</td>
</tr>
</tbody>
</table>
<br/>
<?php endif; ?>
<table class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th>Have Problem ?</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul class="uaf_list">
<li><a href="http://goo.gl/NYtZsX" target="_blank">Setup Instructions</a></li>
<li><a href="http://goo.gl/FcC7EL" target="_blank">Quick Virtual Support</a></li>
<li><a href="http://goo.gl/XgEqzn" target="_blank">Support Forum</a></li>
<li><a href="http://goo.gl/MKg7VS" target="_blank">Rectify My Problem</a></li>
<li><a href="http://goo.gl/Id7yAo" target="_blank">Contact Us</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<br/>
<table class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th>Recently Added Plugin</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding:4px;">
<a href="http://goo.gl/3XDDzi" target="_blank"><img width="240" alt="Create Masonry Brick Shortcode" src="<?php echo plugins_url("use-any-font/images/wp_masonry_layout.gif"); ?>" class="aligncenter size-full wp-image-426"></a>
</td>
</tr>
</tbody>
</table>
<br/>
<table class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th>Plugins You May Like</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul class="uaf_list">
<li><a href="http://goo.gl/3XDDzi" target="_blank">WP Masonry Layout</a></li>
<li><a href="http://wordpress.org/extend/plugins/any-mobile-theme-switcher/" target="_blank">Any Mobile Theme Switcher</a></li>
<li><a href="http://wordpress.org/extend/plugins/jquery-validation-for-contact-form-7/" target="_blank">Jquery Validation For Contact Form 7</a></li>
<li><a href="http://wordpress.org/extend/plugins/add-tags-and-category-to-page/" target="_blank">Add Tags And Category To Page</a></li>
<li><a href="http://wordpress.org/extend/plugins/block-specific-plugin-updates/" target="_blank">Block Specific Plugin Updates</a></li>
<li><a href="http://wordpress.org/extend/plugins/featured-image-in-rss-feed/" target="_blank">Featured Image In RSS Feed</a></li>
<li><a href="http://wordpress.org/extend/plugins/remove-admin-bar-for-client/" target="_blank">Remove Admin Bar</a></li>
<li><a href="http://wordpress.org/extend/plugins/html-in-category-and-pages/" target="_blank">.html in category and page url</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<br/>
<table class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th>Facebook</th>
</tr>
</thead>
<tbody>
<tr>
<td><iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FDnessCarKey%2F77553779916&amp;width=185&amp;height=180&amp;show_faces=true&amp;colorscheme=light&amp;stream=false&amp;border_color=%23f9f9f9&amp;header=false&amp;appId=215419415167468" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:240px; height:180px;" allowTransparency="true"></iframe>
</td>
</tr>
</tbody>
</table>
<br/>
</td>
</tr>
</table>
</div>

View File

@@ -0,0 +1,61 @@
<?php
if (isset($_POST['ucf_api_key_submit'])){
$uaf_api_key = trim($_POST['uaf_api_key']);
$api_key_return = wp_remote_get('http://dnesscarkey.com/font-convertor/api/validate_key.php?license_key='.$uaf_api_key, array('timeout'=>300));
if ( is_wp_error( $api_key_return ) ) {
$error_message = $api_key_return->get_error_message();
$api_message = "Something went wrong: $error_message";
} else {
$api_key_return = json_decode($api_key_return['body']);
if ($api_key_return->status == 'success'){
update_option('uaf_api_key', $uaf_api_key);
}
$api_message = $api_key_return->msg;
}
}
if (isset($_POST['ucf_api_key_remove'])){
delete_option('uaf_api_key');
$api_message = 'Your Activation key has been removed';
}
$uaf_api_key = get_option('uaf_api_key');
?>
<?php if (!empty($api_message)):?>
<div class="updated" id="message"><p><?php echo $api_message ?></p></div>
<?php endif; ?>
<div class="wrap">
<h2>Use Any Font</h2>
<table width="100%">
<tr>
<td valign="top">
<table class="wp-list-table widefat fixed bookmarks">
<thead>
<tr>
<th>API KEY</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<form action="admin.php?page=uaf_settings_page" method="post" >
API KEY :
<?php if (empty($uaf_api_key)): ?>
<input name="uaf_api_key" type="text" style="width:350px; margin-left:50px;" />
<input type="submit" name="ucf_api_key_submit" class="button-primary" value="Verify" style="padding:2px;" />
<br/> <br/>
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://dnesscarkey.com/font-convertor/api/" target="_blank">here</a>.<br/>
<?php else: ?>
<span class="active_key"><?php echo $uaf_api_key; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Active</span> <input type="submit" name="ucf_api_key_remove" class="button-primary" value="Remove Key" style="padding:2px; margin-left:20px;" onclick="if(!confirm('Are you sure ?')){return false;}" />
<?php endif;?>
</form>
<br/>
<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.
<br/><br/>
</td>
</tr>
</tbody>
</table>
<br/>