1<?php
2/********************************
3OSBib:
4A collection of PHP classes to create and manage bibliographic formatting for OS bibliography software
5using the OSBib standard.
6
7Released through http://bibliophile.sourceforge.net under the GPL licence.
8Do whatever you like with this -- some credit to the author(s) would be appreciated.
9
10If you make improvements, please consider contacting the administrators at bibliophile.sourceforge.net
11so that your improvements can be added to the release package.
12
13Adapted from WIKINDX: http://wikindx.sourceforge.net
14
15Mark Grimshaw 2005
16http://bibliophile.sourceforge.net
17********************************/
18/**
19*	Miscellaneous HTML FORM processing
20*
21*	@author Mark Grimshaw
22*
23*	$Header: /cvsroot/bibliophile/OSBib/create/FORMMISC.php,v 1.1 2005/06/20 22:26:51 sirfragalot Exp $
24*/
25class FORMMISC
26{
27// constructor
28	function FORMMISC()
29	{
30	}
31// reduce the size of long text (in select boxes usually) to keep web browser display tidy
32// optional $override allows the programmer to override the user set preferences
33	function reduceLongText($text, $override = FALSE)
34	{
35		$limit = $override ? $override : 40;
36		if(($limit != -1) && ($count = preg_match_all("/./", $text, $throwAway)) > $limit)
37		{
38			$start = floor(($limit/2) - 2);
39			$length = $count - (2 * $start);
40			$text = substr_replace($text, " ... ", $start, $length);
41		}
42		return $text;
43	}
44}
45?>
46