Formatting

This commit is contained in:
Miles Lott 2001-07-26 11:25:35 +00:00
parent 375750ea7e
commit a2c0d12173

View File

@ -23,19 +23,22 @@
/* $Id$ */ /* $Id$ */
class graphics class graphics
{ {
// put a valid font here /* put a valid font here */
var $font="/opt/future-project/src/management-server/ttf/arial.ttf"; var $font="/opt/future-project/src/management-server/ttf/arial.ttf";
function createImage($_text, $_fontsize=11) function createImage($_text, $_fontsize=11)
{ {
// create filename /* create filename */
$filename="button_".md5($_text).".png"; $filename = 'button_' . md5($_text) . '.png';
$filename=strtolower($filename); $filename = strtolower($filename);
// see if file exists already, we cache it /* see if file exists already, we cache it */
if (file_exists(PHPGW_IMAGES_FILEDIR.'/'.$filename)) return $filename; if (file_exists(PHPGW_IMAGES_FILEDIR.'/'.$filename))
{
return $filename;
}
$size = imagettfbbox($_fontsize,0,$this->font,$_text); $size = imagettfbbox($_fontsize,0,$this->font,$_text);
$dx = abs($size[2]-$size[0]); $dx = abs($size[2]-$size[0]);
@ -58,7 +61,7 @@ class graphics
function createInputButton($_text, $_name, $_mode='graphic') function createInputButton($_text, $_name, $_mode='graphic')
{ {
if ($_mode == 'graphic' && extension_loaded("gd")) if ($_mode == 'graphic' && extension_loaded('gd'))
{ {
return '<input type="image" src="/phpgroupware/phpgwapi/templates/default/images/'.$this->createImage($_text).'" border="0" name="'.$_name.'">'; return '<input type="image" src="/phpgroupware/phpgwapi/templates/default/images/'.$this->createImage($_text).'" border="0" name="'.$_name.'">';
} }
@ -73,7 +76,10 @@ class graphics
function parseHTTPPostVars() function parseHTTPPostVars()
{ {
// execute only if libgd support is enabled // execute only if libgd support is enabled
if (!extension_loaded("gd")) return; if (!extension_loaded('gd'))
{
return;
}
global $HTTP_POST_VARS; global $HTTP_POST_VARS;
@ -87,12 +93,7 @@ class graphics
global $$name; global $$name;
$$name = "content generated by parseHTTPPostVars()"; $$name = "content generated by parseHTTPPostVars()";
} }
} }
} }
} }
}
}