',
$width,
$height,
($align ? "align=\"$align\" " : ""),
($extras ? $extras : "")
);
}
# resize_image()
# tag the output of make_image() and resize it manually
# (considering possible HTML/XHTML image tag endings)
#
function resize_image($img, $width=1, $height=1) {
$str = preg_replace('!width=\"([0-9]+?)\"!i', '', $img );
$str = preg_replace('!height=\"([0-9]+?)\"!i', '', $str );
return preg_replace('!/?>$!', sprintf(' height="%s" width="%s" />', $height, $width), $str);
}
# make_image()
# return an IMG tag for a given file (relative to the images dir)
#
function make_image($file, $alt=false, $align=false, $extras=false, $dir=false, $border=0) {
global $HTTP_SERVER_VARS;
if (!$dir) {
$dir = '/images';
}
if ($size = @getimagesize($HTTP_SERVER_VARS['DOCUMENT_ROOT'].$dir.'/'.$file)) {
$image = sprintf('
',
$dir,
$file,
$border,
$size[3],
($alt ? $alt : ''),
($align ? ' align="'.$align.'"' : ''),
($extras ? ' '.$extras : '')
);
} else {
$image = sprintf('
',
$dir,
$file,
$border,
($alt ? $alt : ''),
($align ? ' ALIGN="'.$align.'"' : ''),
($extras ? ' '.$extras : '')
);
}
return $image;
}
# print_image()
# print an IMG tag for a given file
#
function print_image($file, $alt=false, $align=false, $extras=false, $dir=false, $border=0) {
print make_image($file, $alt, $align, $extras, $dir);
}
# make_submit()
# - make a submit button image
#
function make_submit($file, $alt=false, $align=false, $extras=false, $dir=false, $border=0) {
if (!$dir) {
$dir = '/images';
}
$return = make_image($file, $alt, $align, $extras, $dir, $border);
if ($return != "
") {
$return = '';
}
return $return;
}
# delim()
# print a pipe delimiter
#
function delim($color=false) {
if (!$color) {
return ' | ';
}
return sprintf(' | ', $color );
}
# hdelim()
# print a horizontal delimiter (just a wide line);
#
function hdelim($color="#000000") {
if (!$color) {
return '
';
}
return sprintf('
', $color );
}
# make_link()
# return a hyperlink to something, within the site
#
function make_link ($url, $linktext=false, $target=false, $extras=false) {
return sprintf("%s",
$url,
($target ? ' target="'.$target.'"' : ''),
($extras ? ' '.$extras : ''),
($linktext ? $linktext : $url)
);
}
# print_link()
# echo a hyperlink to something, within the site
#
function print_link($url, $linktext=false, $target=false, $extras=false) {
echo make_link($url, $linktext, $target, $extras);
}
# make_popup_link()
# return a hyperlink to something, within the site, that pops up a new window
#
function make_popup_link ($url, $linktext=false, $target=false, $windowprops="", $extras=false) {
return sprintf("%s",
htmlspecialchars($url),
($target ? $target : "_new"),
htmlspecialchars($url),
($target ? $target : "_new"),
$windowprops,
($extras ? ' '.$extras : ''),
($linktext ? $linktext : $url)
);
}
# print_popup_link()
# echo a hyperlink to something, within the site, that pops up a new window
#
function print_popup_link($url, $linktext=false, $windowprops="", $target=false, $extras=false) {
echo make_popup_link($url, $linktext, $windowprops, $target, $extras);
}
# download_link()
# print a link for a downloadable file (including filesize)
#
function download_link($file, $title, $showsize = true, $mirror = '') {
$download_link = "get/$file/from/a/mirror";
if ($mirror != '') {
$download_link = $mirror . $download_link;
} else {
$download_link = "/" . $download_link;
}
print_link($download_link, $title);
if ($showsize) {
if ($tmp = strrchr($file, "/")) {
$local_file = substr($tmp, 1, strlen($tmp));
} else {
$local_file = "distributions/$file";
}
$size = @filesize($local_file);
/* Print out size in bytes (if size is less the 1Kb, or else in Kb) */
if ($size) {
echo ' [';
if ($size < 1024) {
echo number_format($size, 0, '.', ',') . 'b';
} else {
echo number_format($size/1024, 0, '.', ',') . 'Kb';
}
echo ']';
}
}
}
$enclosed = 0;
# commonheader()
#
#
function commonHeader($title="",$dont_enclose=0,$headers_gone=0) {
global $MYSITE, $base, $enclosed, $EXPL_LANG, $SIDEBAR_DATA, $SEARCH_BASE;
?>
PHP
' : ''); ?>
|
|
|
|
You are using . However, foo.php.net is closer. We would appreciate if you could use that mirror.
| | ";
if (!empty($RSIDEBAR_DATA)) { ?>
|
|
\n";
}
?>
All rights reserved. |
This mirror generously provided by:
Last updated:
|
\n";
}
function sect_to_file($string) {
$string = strtolower($string);
$string = str_replace(' ','-',$string);
$string = str_replace('_','-',$string);
$func = "function.$string.php";
$chap = "ref.$string.php";
$feat = "features.$string.php";
$struct = "control-structures.$string.php";
if(@is_file($func)) return $func;
else if(@is_file($chap)) return $chap;
else if(@is_file($feat)) return $feat;
else if(@is_file($struct)) return $struct;
else return "$string.php";
}
function clean($var) {
return htmlspecialchars(get_magic_quotes_gpc() ? stripslashes($var) : $var);
}
function clean_note($text) {
$text = htmlspecialchars(trim($text));
/* turn urls into links */
$text = preg_replace("/((mailto|http|ftp|nntp|news):.+?)(>|\\s|\\)|\"|\\.\\s|$)/","\\1\\3",$text);
/* this 'fixing' code will go away eventually. */
$fixes = array('
','','
');
reset($fixes);
while (list(,$f)=each($fixes)) {
$text=str_replace(htmlspecialchars($f), $f, $text);
$text=str_replace(htmlspecialchars(strtoupper($f)), $f, $text);
}
/* Make sure tags stay in the CSS "note" class*/
$text = str_replace (array ('
', '
'), '
', $text);
/* preserve linebreaks */
$text = str_replace("\n", "
", $text);
/* this will only break long lines */
if (function_exists("wordwrap")) {
$text = wordwrap($text);
}
// Preserve spacing of user notes
$text = str_replace(" ", " ", $text);
$text = "".$text."";
return $text;
}
function display_errors($errors)
{
echo '
';
if (count($errors) > 1) {
echo "You need to do the following before your submission will be accepted:
";
foreach ($errors as $error) {
echo "- $error
\n";
}
echo "
";
}
else {
echo $errors[0];
}
echo '
';
}
function display_event($event,$include_date=1)
{
for ($i = 1; $i <= 7; $i++) {
$days[$i] = strftime('%A',mktime(12,0,0,4,$i,2001));
}
$re = array(1=>'First',2=>'Second',3=>'Third',4=>'Fourth',-1=>'Last',-2=>'2nd Last',-3=>'3rd Last');
$sday = $event['start'] ? strtotime($event['start'])
: mktime(0,0,1,$event['smonth'],$event['sday'],$event['syear']);
$eday = $event['end'] ? strtotime($event['end'])
: mktime(0,0,1,$event['emonth'],$event['eday'],$event['eyear']);
?>
|
", date("F j, Y", $sday), "\n";
if ($event['url']) echo '';
echo "", stripslashes(htmlentities($event['sdesc'])), "";
if ($event['url']) echo "";
switch ($event['type']) {
case 2:
case 'multi':
echo " (", date("Y-m-d",$sday), " to ", date("Y-m-d",$eday), ")";
break;
case 3:
case 'recur':
echo " (Every ", $re[$event['recur']], " ", $days[$event['recur_day']], " of the month)";
break;
}
?>
|
",trim($event['ldesc'])); if ($event['url']) {?>
URL: ',htmlentities($event['url']),''; }?> |