mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
pdf plugin - show list of available fonts in admin
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
* Plugin Administration - PDF generator
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/admin_pdf_config.php,v $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2009-12-05 12:33:30 $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 2009-12-07 20:46:56 $
|
||||
* $Author: e107steved $
|
||||
*
|
||||
*/
|
||||
@@ -107,6 +107,82 @@ $pdfpref = getPDFPrefs();
|
||||
|
||||
if(!is_object($sql)){ $sql = new db; }
|
||||
|
||||
// Default list just in case
|
||||
$fontlist=array('times','courier','helvetica','symbol');
|
||||
|
||||
|
||||
function getFontInfo($fontName)
|
||||
{
|
||||
$type = 'empty'; // Preset the stuff we're going to read
|
||||
$dw = 0;
|
||||
$cw = array();
|
||||
$name='';
|
||||
//$desc=array('Ascent'=>900,'Descent'=>-300,'CapHeight'=>-29,'Flags'=>96,'FontBBox'=>'[-879 -434 1673 900]','ItalicAngle'=>-16.5,'StemV'=>70,'MissingWidth'=>600);
|
||||
//$up=-125;
|
||||
//$ut=50;
|
||||
include(e_PLUGIN.'pdf/font/'.$fontName);
|
||||
return array('type' => $type, 'weight' => $dw, 'codes' => count($cw), 'name' => $name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getFontList($match = '')
|
||||
{
|
||||
require_once(e_HANDLER.'file_class.php');
|
||||
$fl = new e_file();
|
||||
if (!$match) $match = '~^uni2cid';
|
||||
$fileList = $fl->get_files(e_PLUGIN.'pdf/font/',$match, 'standard', 1);
|
||||
$fontList = array();
|
||||
$intList = array();
|
||||
foreach ($fileList as $v)
|
||||
{
|
||||
if (isset($v['fname']) && (substr($v['fname'],-4) == '.php'))
|
||||
{
|
||||
$intList[] = substr($v['fname'],0,-4);
|
||||
}
|
||||
}
|
||||
unset($fileList);
|
||||
sort($intList); // This will guarantee that base font names appear before bold, italic etc
|
||||
foreach ($intList as $f)
|
||||
{
|
||||
if (substr($f,-2) == 'bi')
|
||||
{
|
||||
$fontList[substr($f,0,-2)]['bi'] = $f.'.php';
|
||||
}
|
||||
elseif (substr($f,-1) == 'i')
|
||||
{
|
||||
$fontList[substr($f,0,-1)]['i'] = $f.'.php';
|
||||
}
|
||||
elseif (substr($f,-1) == 'b')
|
||||
{
|
||||
$fontList[substr($f,0,-1)]['b'] = $f.'.php';
|
||||
}
|
||||
else
|
||||
{ // Must be base font name
|
||||
$fontList[$f]['base'] = $f.'.php';
|
||||
}
|
||||
}
|
||||
// Now get the info on each font.
|
||||
foreach ($fontList as $font => $info)
|
||||
{
|
||||
$fontList[$font]['info'] = getFontInfo($info['base']);
|
||||
}
|
||||
//print_a($fontList);
|
||||
return $fontList;
|
||||
}
|
||||
|
||||
|
||||
$fontList = getFontList();
|
||||
$coreList = array();
|
||||
foreach ($fontList as $font => $info)
|
||||
{
|
||||
if ($info['info']['type'] == 'core')
|
||||
{
|
||||
$coreList[$font] = $font;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$text = "
|
||||
<div style='text-align:center'>
|
||||
".$rs -> form_open("post", e_SELF, "pdfform", "", "enctype='multipart/form-data'")."
|
||||
@@ -125,13 +201,13 @@ $text = "
|
||||
<td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_margin_top", 10, $pdfpref['pdf_margin_top'], 10)."</td>
|
||||
</tr>";
|
||||
|
||||
$fontlist=array('times','courier','helvetica','symbol');
|
||||
$text .= "
|
||||
<tr>
|
||||
<td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_8."</td>
|
||||
<td class='forumheader3' style='width:70%;'>
|
||||
".$rs -> form_select_open("pdf_font_family");
|
||||
foreach($fontlist as $font){
|
||||
foreach($coreList as $font => $info)
|
||||
{
|
||||
$text .= $rs -> form_option($font, ($pdfpref['pdf_font_family'] == $font ? "1" : "0"), $font);
|
||||
}
|
||||
$text .= $rs -> form_select_close()."
|
||||
@@ -200,6 +276,26 @@ $text .= "
|
||||
|
||||
$ns -> tablerender(PDF_LAN_2, $text);
|
||||
|
||||
|
||||
$text = "<div style='text-align:center;>\n
|
||||
<table cellpadding='0' cellspacing='0' class='adminform'>
|
||||
<tr><th>".PDF_LAN_21."</th><th>".PDF_LAN_22."</th><th>".PDF_LAN_23."</th>
|
||||
<th>".PDF_LAN_24."</th><th title='".PDF_LAN_25."'>".PDF_LAN_26."</th></tr>\n";
|
||||
|
||||
foreach ($fontList as $font => $info)
|
||||
{
|
||||
$wa = array(PDF_LAN_27);
|
||||
if (isset($info['b'])) $wa[] = PDF_LAN_28;
|
||||
if (isset($info['i'])) $wa[] = PDF_LAN_29;
|
||||
if (isset($info['bi'])) $wa[] = PDF_LAN_30;
|
||||
$variants = implode(', ', $wa);
|
||||
$text .= "<tr><td>{$font}</td><td>{$info['info']['type']}</td><td>{$variants}</td><td>{$info['info']['weight']}</td><td>{$info['info']['codes']}</td></tr>\n";
|
||||
}
|
||||
|
||||
$text .= "</table></div>";
|
||||
$ns->tablerender(PDF_LAN_31, $text);
|
||||
|
||||
|
||||
require_once(e_ADMIN."footer.php");
|
||||
|
||||
?>
|
@@ -4,37 +4,48 @@
|
||||
| e107 website system - Language File.
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/languages/English_admin_pdf.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2009-12-05 12:33:30 $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2009-12-07 20:46:56 $
|
||||
| $Author: e107steved $
|
||||
+-----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
define("PDF_PLUGIN_LAN_1", "PDF");
|
||||
define("PDF_PLUGIN_LAN_2", "PDF creation support using TCPDF");
|
||||
define("PDF_PLUGIN_LAN_3", "PDF");
|
||||
define("PDF_PLUGIN_LAN_4", "This plugin is now ready to be used.");
|
||||
define('PDF_PLUGIN_LAN_1', 'PDF');
|
||||
define('PDF_PLUGIN_LAN_2', 'PDF creation support using TCPDF');
|
||||
define('PDF_PLUGIN_LAN_3', 'PDF');
|
||||
define('PDF_PLUGIN_LAN_4', 'This plugin is now ready to be used.');
|
||||
|
||||
define("PDF_LAN_1", "PDF");
|
||||
define("PDF_LAN_2", "PDF preferences");
|
||||
define("PDF_LAN_3", "enabled");
|
||||
define("PDF_LAN_4", "disabled");
|
||||
define("PDF_LAN_5", "page margin left");
|
||||
define("PDF_LAN_6", "page margin right");
|
||||
define("PDF_LAN_7", "page margin top");
|
||||
define("PDF_LAN_8", "font family");
|
||||
define("PDF_LAN_9", "font size default");
|
||||
define("PDF_LAN_10", "font size sitename");
|
||||
define("PDF_LAN_11", "font size page url");
|
||||
define("PDF_LAN_12", "font size page number");
|
||||
define("PDF_LAN_13", "show logo on pdf?");
|
||||
define("PDF_LAN_14", "show sitename on pdf?");
|
||||
define("PDF_LAN_15", "show creator page url on pdf?");
|
||||
define("PDF_LAN_16", "show page numbers on pdf?");
|
||||
define("PDF_LAN_17", "update");
|
||||
define("PDF_LAN_18", "PDF preferences successfully updated");
|
||||
define("PDF_LAN_19", "Page");
|
||||
define("PDF_LAN_20", "error reporting");
|
||||
define('PDF_LAN_1', 'PDF');
|
||||
define('PDF_LAN_2', 'PDF preferences');
|
||||
define('PDF_LAN_3', 'enabled');
|
||||
define('PDF_LAN_4', 'disabled');
|
||||
define('PDF_LAN_5', 'page margin left');
|
||||
define('PDF_LAN_6', 'page margin right');
|
||||
define('PDF_LAN_7', 'page margin top');
|
||||
define('PDF_LAN_8', 'font family');
|
||||
define('PDF_LAN_9', 'font size default');
|
||||
define('PDF_LAN_10', 'font size sitename');
|
||||
define('PDF_LAN_11', 'font size page url');
|
||||
define('PDF_LAN_12', 'font size page number');
|
||||
define('PDF_LAN_13', 'show logo on pdf?');
|
||||
define('PDF_LAN_14', 'show sitename on pdf?');
|
||||
define('PDF_LAN_15', 'show creator page url on pdf?');
|
||||
define('PDF_LAN_16', 'show page numbers on pdf?');
|
||||
define('PDF_LAN_17', 'update');
|
||||
define('PDF_LAN_18', 'PDF preferences successfully updated');
|
||||
define('PDF_LAN_19', 'Page');
|
||||
define('PDF_LAN_20', 'error reporting');
|
||||
define('PDF_LAN_21', 'Font name');
|
||||
define('PDF_LAN_22', 'Font Type');
|
||||
define('PDF_LAN_23', 'Variants');
|
||||
define('PDF_LAN_24', 'Weight');
|
||||
define('PDF_LAN_25', 'This is an indication of the level of utf-8 support');
|
||||
define('PDF_LAN_26', 'Codes');
|
||||
define('PDF_LAN_27', 'std'); // 'Normal' font type
|
||||
define('PDF_LAN_28', 'bold'); // Bold font type
|
||||
define('PDF_LAN_29', 'ital'); // Italic font type
|
||||
define('PDF_LAN_30', 'boldital'); // Bold italic font type
|
||||
define('PDF_LAN_31', 'FONT LIST');
|
||||
|
||||
|
||||
// Admin logging
|
||||
|
@@ -9,8 +9,8 @@
|
||||
* Plugin - PDF Generator
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/pdf.php,v $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2009-12-06 10:45:50 $
|
||||
* $Revision: 1.7 $
|
||||
* $Date: 2009-12-07 20:46:56 $
|
||||
* $Author: e107steved $
|
||||
*
|
||||
*/
|
||||
@@ -34,8 +34,15 @@ if(strpos($source,'plugin:') !== FALSE)
|
||||
if(file_exists(e_PLUGIN.$plugin.'/e_emailprint.php'))
|
||||
{
|
||||
include_once(e_PLUGIN.$plugin.'/e_emailprint.php');
|
||||
$text = print_item_pdf($parms);
|
||||
$pdf->makePDF($text);
|
||||
if (function_exists('print_item_pdf'))
|
||||
{
|
||||
$text = print_item_pdf($parms);
|
||||
$pdf->makePDF($text);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'PDF generation not supported in this section';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user