1.What's exactly the license of FPDF? Are there any usage restrictions?
+FPDF is released under a permissive license: there is no usage restriction. You may embed it
+freely in your application (commercial or not), with or without modifications.
+
+
+
+
2.When I try to create a PDF, a lot of weird characters show on the screen. Why?
+These "weird" characters are in fact the actual content of your PDF. This behavior is a bug of
+IE6. When it first receives an HTML page, then a PDF from the same URL, it displays it directly
+without launching Acrobat. This happens frequently during the development stage: on the least
+script error, an HTML page is sent, and after correction, the PDF arrives.
+
+To solve the problem, simply quit and restart IE. You can also go to another URL and come
+back.
+
+To avoid this kind of inconvenience during the development, you can generate the PDF directly
+to a file and open it through the explorer.
+
+
+
+
3.I try to generate a PDF and IE displays a blank page. What happens?
+First of all, check that you send nothing to the browser after the PDF (not even a space or a
+carriage return). You can put an exit statement just after the call to the Output() method to
+be sure. If it still doesn't work, it means you're a victim of the "blank page syndrome". IE
+used in conjunction with the Acrobat plug-in suffers from many bugs. To avoid these problems
+in a reliable manner, two main techniques exist:
+
+
+- Disable the plug-in and use Acrobat as a helper application. To do this, launch Acrobat, go
+to the Edit menu, Preferences, Internet, and uncheck "Display PDF in browser". Then, the next
+time you load a PDF in IE, it displays the dialog box "Open it" or "Save it to disk". Uncheck
+the option "Always ask before opening this type of file" and choose Open. From now on, PDF files
+will open automatically in an external Acrobat window.
+
+The drawback of the method is that you need to alter the client configuration, which you can do
+in an intranet environment but not for the Internet.
+
+
+- Use a redirection technique. It consists in generating the PDF in a temporary file on the server
+and redirect the client to it. For example, at the end of the script, you can put the following:
+
+
//Determine a temporary file name in the current directory
+$file = basename(tempnam('.', 'tmp'));
+rename($file, $file.'.pdf');
+$file .= '.pdf';
+//Save PDF to file
+$pdf->Output($file, 'F');
+//Redirect
+header('Location: '.$file);
+
+This method turns the dynamic PDF into a static one and avoids all troubles. But you have to do
+some cleaning in order to delete the temporary files. For example:
+
+This function deletes all files of the form tmp*.pdf older than an hour in the specified
+directory. You may call it where you want, for example in the script which generates the PDF.
+
+
+
+
4.I can't make line breaks work. I put \n in the string printed by MultiCell but it doesn't work.
+You have to enclose your string with double quotes, not single ones.
+
+
+
+
5.I try to display a variable in the Header method but nothing prints.
+You have to use the global keyword to access global variables, for example:
+
+Don't use UTF-8 encoding. Standard FPDF fonts use ISO-8859-1 or Windows-1252.
+It is possible to perform a conversion to ISO-8859-1 with utf8_decode():
+
+
$str = utf8_decode($str);
+
+But some characters such as Euro won't be translated correctly. If the iconv extension is available, the
+right way to do it is the following:
+
+
$str = iconv('UTF-8', 'windows-1252', $str);
+
+
+
+
+
8.I try to display the Euro symbol but it doesn't work.
+The standard fonts have the Euro character at position 128. You can define a constant like this
+for convenience:
+
+
define('EURO', chr(128));
+
+
+
+
+
9.I get the following error when I try to generate a PDF: Some data has already been output, can't send PDF file
+You must send nothing to the browser except the PDF itself: no HTML, no space, no carriage return. A common
+case is having extra blank at the end of an included script file.
+If you can't figure out where the problem comes from, this other message appearing just before can help you:
+
+Warning: Cannot modify header information - headers already sent by (output started at script.php:X)
+
+It means that script.php outputs something at line X. Go to this line and fix it.
+In case the message doesn't show, first check that you didn't disable warnings, then add this at the very
+beginning of your script:
+
+
ob_end_clean();
+
+If you still don't see it, disable zlib.output_compression in your php.ini and it should appear.
+
+
+
+
10.I draw a frame with very precise dimensions, but when printed I notice some differences.
+To respect dimensions, select "None" for the Page Scaling setting instead of "Shrink to Printable Area" in the print dialog box.
+
+
+
+
11.I'd like to use the whole surface of the page, but when printed I always have some margins. How can I get rid of them?
+Printers have physical margins (different depending on the models); it is therefore impossible to remove
+them and print on the whole surface of the paper.
+
+
+
+
12.How can I put a background in my PDF?
+For a picture, call Image() in the Header() method, before any other output. To set a background color, use Rect().
+
+
+
+
13.How can I set a specific header or footer on the first page?
16.What's the limit of the file sizes I can generate with FPDF?
+There is no particular limit. There are some constraints, however:
+
+
+- The maximum memory size allocated to PHP scripts is usually 8MB. For very big documents,
+especially with images, this limit may be reached (the file being built into memory). The
+parameter is configured in the php.ini file.
+
+
+- The maximum execution time allocated defaults to 30 seconds. This limit can of course be easily
+reached. It is configured in php.ini and may be altered dynamically with set_time_limit().
+
+
+- Browsers generally have a 5 minute time-out. If you send the PDF directly to the browser and
+reach the limit, it will be lost. It is therefore advised for very big documents to
+generate them in a file, and to send some data to the browser from time to time (with a call
+to flush() to force the output). When the document is finished, you can send a redirection to
+it or create a link.
+
+Remark: even if the browser times out, the script may continue to run on the server.
+
18.I'd like to make a search engine in PHP and index PDF files. Can I do it with FPDF?
+No. But a GPL C utility does exist, pdftotext, which is able to extract the textual content from
+a PDF. It is provided with the Xpdf package:
+
+http://www.foolabs.com/xpdf/
+
+
+
+
19.Can I convert an HTML page to PDF with FPDF?
+Not real-world pages. But a GPL C utility does exist, htmldoc, which allows to do it and gives good results:
+
+http://www.htmldoc.org
+
+
+
+
20.Can I concatenate PDF files with FPDF?
+Not directly, but it is possible to use FPDI
+to perform this task. Some free command-line tools also exist:
+
+mbtPdfAsm
+pdftk
+
+- The MakeFont utility has been completely rewritten and doesn't depend on ttf2pt1 anymore.
+- Alpha channel is now supported for PNGs.
+- When inserting an image, it's now possible to specify its resolution.
+- Default resolution for images was increased from 72 to 96 dpi.
+- When inserting a GIF image, no temporary file is used anymore if the PHP version is 5.1 or higher.
+- When output buffering is enabled and the PDF is about to be sent, the buffer is now cleared if it contains only a UTF-8 BOM and/or whitespace (instead of throwing an error).
+- Symbol and ZapfDingbats fonts now support underline style.
+- Custom page sizes are now checked to ensure that width is smaller than height.
+- Standard font files were changed to use the same format as user fonts.
+- A bug in the embedding of Type1 fonts was fixed.
+- A bug related to SetDisplayMode() and the current locale was fixed.
+- A display issue occurring with the Adobe Reader X plug-in was fixed.
+- An issue related to transparency with some versions of Adobe Reader was fixed.
+- The Content-Length header was removed because it caused an issue when the HTTP server applies compression.
+
+
v1.6 (2008-08-03)
+
+- PHP 4.3.10 or higher is now required.
+- GIF image support.
+- Images can now trigger page breaks.
+- Possibility to have different page formats in a single document.
+- Document properties (author, creator, keywords, subject and title) can now be specified in UTF-8.
+- Fixed a bug: when a PNG was inserted through a URL, an error sometimes occurred.
+- An automatic page break in Header() doesn't cause an infinite loop any more.
+- Removed some warning messages appearing with recent PHP versions.
+- Added HTTP headers to reduce problems with IE.
+
+
v1.53 (2004-12-31)
+
+- When the font subdirectory is in the same directory as fpdf.php, it's no longer necessary to define the FPDF_FONTPATH constant.
+- The array $HTTP_SERVER_VARS is no longer used. It could cause trouble on PHP5-based configurations with the register_long_arrays option disabled.
+- Fixed a problem related to Type1 font embedding which caused trouble to some PDF processors.
+- The file name sent to the browser could not contain a space character.
+- The Cell() method could not print the number 0 (you had to pass the string '0').
+
+
v1.52 (2003-12-30)
+
+- Image() now displays the image at 72 dpi if no dimension is given.
+- Output() takes a string as second parameter to indicate destination.
+- Open() is now called automatically by AddPage().
+- Inserting remote JPEG images doesn't generate an error any longer.
+- Decimal separator is forced to dot in the constructor.
+- Added several encodings (Turkish, Thai, Hebrew, Ukrainian and Vietnamese).
+- The last line of a right-aligned MultiCell() was not correctly aligned if it was terminated by a carriage return.
+- No more error message about already sent headers when outputting the PDF to the standard output from the command line.
+- The underlining was going too far for text containing characters \, ( or ).
+- $HTTP_ENV_VARS has been replaced by $HTTP_SERVER_VARS.
+
+
v1.51 (2002-08-03)
+
+- Type1 font support.
+- Added Baltic encoding.
+- The class now works internally in points with the origin at the bottom in order to avoid two bugs occurring with Acrobat 5 : * The line thickness was too large when printed under Windows 98 SE and ME. * TrueType fonts didn't appear immediately inside the plug-in (a substitution font was used), one had to cause a window refresh to make them show up.
+- It's no longer necessary to set the decimal separator as dot to produce valid documents.
+- The clickable area in a cell was always on the left independently from the text alignment.
+- JPEG images in CMYK mode appeared in inverted colors.
+- Transparent PNG images in grayscale or true color mode were incorrectly handled.
+- Adding new fonts now works correctly even with the magic_quotes_runtime option set to on.
+
+
v1.5 (2002-05-28)
+
+- TrueType font (AddFont()) and encoding support (Western and Eastern Europe, Cyrillic and Greek).
+- Added Write() method.
+- Added underlined style.
+- Internal and external link support (AddLink(), SetLink(), Link()).
+- Added right margin management and methods SetRightMargin(), SetTopMargin().
+- Modification of SetDisplayMode() to select page layout.
+- The border parameter of MultiCell() now lets choose borders to draw as Cell().
+- When a document contains no page, Close() now calls AddPage() instead of causing a fatal error.
+
+
v1.41 (2002-03-13)
+
+- Fixed SetDisplayMode() which no longer worked (the PDF viewer used its default display).
+
+
v1.4 (2002-03-02)
+
+- PHP3 is no longer supported.
+- Page compression (SetCompression()).
+- Choice of page format and possibility to change orientation inside document.
+- Added AcceptPageBreak() method.
+- Ability to print the total number of pages (AliasNbPages()).
+- Choice of cell borders to draw.
+- New mode for Cell(): the current position can now move under the cell.
+- Ability to include an image by specifying height only (width is calculated automatically).
+- Fixed a bug: when a justified line triggered a page break, the footer inherited the corresponding word spacing.
+
+
v1.31 (2002-01-12)
+
+- Fixed a bug in drawing frame with MultiCell(): the last line always started from the left margin.
+- Removed Expires HTTP header (gives trouble in some situations).
+- Added Content-disposition HTTP header (seems to help in some situations).
+
+
v1.3 (2001-12-03)
+
+- Line break and text justification support (MultiCell()).
+- Color support (SetDrawColor(), SetFillColor(), SetTextColor()). Possibility to draw filled rectangles and paint cell background.
+- A cell whose width is declared null extends up to the right margin of the page.
+- Line width is now retained from page to page and defaults to 0.2 mm.
+- Added SetXY() method.
+- Fixed a passing by reference done in a deprecated manner for PHP4.
+
+
v1.2 (2001-11-11)
+
+- Added font metric files and GetStringWidth() method.
+- Centering and right-aligning text in cells.
+- Display mode control (SetDisplayMode()).
+- Added methods to set document properties (SetAuthor(), SetCreator(), SetKeywords(), SetSubject(), SetTitle()).
+- Possibility to force PDF download by browser.
+- Added SetX() and GetX() methods.
+- During automatic page break, current abscissa is now retained.
+
+
v1.11 (2001-10-20)
+
+- PNG support doesn't require PHP4/zlib any more. Data are now put directly into PDF without any decompression/recompression stage.
+- Image insertion now works correctly even with magic_quotes_runtime option set to on.
+
+
v1.1 (2001-10-07)
+
+- JPEG and PNG image support.
+
+
v1.01 (2001-10-03)
+
+- Fixed a bug involving page break: in case when Header() doesn't specify a font, the one from previous page was not restored and produced an incorrect document.
+
+Whenever a page break condition is met, the method is called, and the break is issued or not
+depending on the returned value. The default implementation returns a value according to the
+mode selected by SetAutoPageBreak().
+
+This method is called automatically and should not be called directly by the application.
+
Example
+The method is overriden in an inherited class in order to obtain a 3 column layout:
+
+
class PDF extends FPDF
+{
+var $col = 0;
+
+function SetCol($col)
+{
+ // Move position to a column
+ $this->col = $col;
+ $x = 10+$col*65;
+ $this->SetLeftMargin($x);
+ $this->SetX($x);
+}
+
+function AcceptPageBreak()
+{
+ if($this->col<2)
+ {
+ // Go to next column
+ $this->SetCol($this->col+1);
+ $this->SetY(10);
+ return false;
+ }
+ else
+ {
+ // Go back to first column and issue page break
+ $this->SetCol(0);
+ return true;
+ }
+}
+}
+
+$pdf = new PDF();
+$pdf->AddPage();
+$pdf->SetFont('Arial','',12);
+for($i=1;$i<=300;$i++)
+ $pdf->Cell(0,5,"Line $i",0,1);
+$pdf->Output();
+AddFont(string family [, string style [, string file]])
+
Description
+Imports a TrueType, OpenType or Type1 font and makes it available. It is necessary to generate a font
+definition file first with the MakeFont utility.
+
+The definition file (and the font file itself when embedding) must be present in the font directory.
+If it is not found, the error "Could not include font definition file" is raised.
+
Parameters
+
+
family
+
+Font family. The name can be chosen arbitrarily. If it is a standard family name, it will
+override the corresponding font.
+
+
style
+
+Font style. Possible values are (case insensitive):
+
+
empty string: regular
+
B: bold
+
I: italic
+
BI or IB: bold italic
+
+The default value is regular.
+
+
file
+
+The font definition file.
+
+By default, the name is built from the family and style, in lower case with no space.
+
+Creates a new internal link and returns its identifier. An internal link is a clickable area
+which directs to another place within the document.
+
+The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is
+defined with SetLink().
+
+Adds a new page to the document. If a page is already present, the Footer() method is called
+first to output the footer. Then the page is added, the current position set to the top-left
+corner according to the left and top margins, and Header() is called to display the header.
+
+The font which was set before calling is automatically restored. There is no need to call
+SetFont() again if you want to continue with the same font. The same is true for colors and
+line width.
+
+The origin of the coordinate system is at the top-left corner and increasing ordinates go
+downwards.
+
Parameters
+
+
orientation
+
+Page orientation. Possible values are (case insensitive):
+
+
P or Portrait
+
L or Landscape
+
+The default value is the one passed to the constructor.
+
+
size
+
+Page size. It can be either one of the following values (case insensitive):
+
+
A3
+
A4
+
A5
+
Letter
+
Legal
+
+or an array containing the width and the height (expressed in user unit).
+
+The default value is the one passed to the constructor.
+
+Defines an alias for the total number of pages. It will be substituted as the document is
+closed.
+
Parameters
+
+
alias
+
+The alias. Default value: {nb}.
+
+
+
Example
+
+
class PDF extends FPDF
+{
+function Footer()
+{
+ // Go to 1.5 cm from bottom
+ $this->SetY(-15);
+ // Select Arial italic 8
+ $this->SetFont('Arial','I',8);
+ // Print current and total page numbers
+ $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
+}
+}
+
+$pdf = new PDF();
+$pdf->AliasNbPages();
+Cell(float w [, float h [, string txt [, mixed border [, int ln [, string align [, boolean fill [, mixed link]]]]]]])
+
Description
+Prints a cell (rectangular area) with optional borders, background color and character string.
+The upper-left corner of the cell corresponds to the current position. The text can be aligned
+or centered. After the call, the current position moves to the right or to the next line. It is
+possible to put a link on the text.
+
+If automatic page breaking is enabled and the cell goes beyond the limit, a page break is
+done before outputting.
+
Parameters
+
+
w
+
+Cell width. If 0, the cell extends up to the right margin.
+
+
h
+
+Cell height.
+Default value: 0.
+
+
txt
+
+String to print.
+Default value: empty string.
+
+
border
+
+Indicates if borders must be drawn around the cell. The value can be either a number:
+
+
0: no border
+
1: frame
+
+or a string containing some or all of the following characters (in any order):
+
+
L: left
+
T: top
+
R: right
+
B: bottom
+
+Default value: 0.
+
+
ln
+
+Indicates where the current position should go after the call. Possible values are:
+
+
0: to the right
+
1: to the beginning of the next line
+
2: below
+
+Putting 1 is equivalent to putting 0 and calling Ln() just after.
+Default value: 0.
+
+
align
+
+Allows to center or align the text. Possible values are:
+
+
L or empty string: left align (default value)
+
C: center
+
R: right align
+
+
+
fill
+
+Indicates if the cell background must be painted (true) or transparent (false).
+Default value: false.
+
+
link
+
+URL or identifier returned by AddLink().
+
+
+
Example
+
+
// Set font
+$pdf->SetFont('Arial','B',16);
+// Move to 8 cm to the right
+$pdf->Cell(80);
+// Centered text in a framed 20*10 mm cell and line break
+$pdf->Cell(20,10,'Title',1,1,'C');
+Terminates the PDF document. It is not necessary to call this method explicitly because Output()
+does it automatically.
+
+If the document contains no page, AddPage() is called to prevent from getting an invalid document.
+
+This method is automatically called in case of fatal error; it simply outputs the message
+and halts the execution. An inherited class may override it to customize the error handling
+but should always halt the script, or the resulting document would probably be invalid.
+
+This method is used to render the page footer. It is automatically called by AddPage() and
+Close() and should not be called directly by the application. The implementation in FPDF is
+empty, so you have to subclass it and override the method if you want a specific processing.
+
Example
+
+
class PDF extends FPDF
+{
+function Footer()
+{
+ // Go to 1.5 cm from bottom
+ $this->SetY(-15);
+ // Select Arial italic 8
+ $this->SetFont('Arial','I',8);
+ // Print centered page number
+ $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
+}
+}
+FPDF([string orientation [, string unit [, mixed size]]])
+
Description
+This is the class constructor. It allows to set up the page size, the orientation and the
+unit of measure used in all methods (except for font sizes).
+
Parameters
+
+
orientation
+
+Default page orientation. Possible values are (case insensitive):
+
+
P or Portrait
+
L or Landscape
+
+Default value is P.
+
+
unit
+
+User unit. Possible values are:
+
+
pt: point
+
mm: millimeter
+
cm: centimeter
+
in: inch
+
+A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This
+is a very common unit in typography; font sizes are expressed in that unit.
+
+
+Default value is mm.
+
+
size
+
+The size used for pages. It can be either one of the following values (case insensitive):
+
+
A3
+
A4
+
A5
+
Letter
+
Legal
+
+or an array containing the width and the height (expressed in the unit given by unit).
+
+Default value is A4.
+
+This method is used to render the page header. It is automatically called by AddPage() and
+should not be called directly by the application. The implementation in FPDF is empty, so
+you have to subclass it and override the method if you want a specific processing.
+
Example
+
+
class PDF extends FPDF
+{
+function Header()
+{
+ // Select Arial bold 15
+ $this->SetFont('Arial','B',15);
+ // Move to the right
+ $this->Cell(80);
+ // Framed title
+ $this->Cell(30,10,'Title',1,0,'C');
+ // Line break
+ $this->Ln(20);
+}
+}
+Image(string file [, float x [, float y [, float w [, float h [, string type [, mixed link]]]]]])
+
Description
+Puts an image. The size it will take on the page can be specified in different ways:
+
+
explicit width and height (expressed in user unit or dpi)
+
one explicit dimension, the other being calculated automatically in order to keep the original proportions
+
no explicit dimension, in which case the image is put at 96 dpi
+
+Supported formats are JPEG, PNG and GIF. The GD extension is required for GIF.
+
+
+For JPEGs, all flavors are allowed:
+
+
gray scales
+
true colors (24 bits)
+
CMYK (32 bits)
+
+For PNGs, are allowed:
+
+
gray scales on at most 8 bits (256 levels)
+
indexed colors
+
true colors (24 bits)
+
+For GIFs: in case of an animated GIF, only the first frame is displayed.
+
+Transparency is supported.
+
+The format can be specified explicitly or inferred from the file extension.
+
+It is possible to put a link on the image.
+
+Remark: if an image is used several times, only one copy is embedded in the file.
+
Parameters
+
+
file
+
+Path or URL of the image.
+
+
x
+
+Abscissa of the upper-left corner. If not specified or equal to null, the current abscissa
+is used.
+
+
y
+
+Ordinate of the upper-left corner. If not specified or equal to null, the current ordinate
+is used; moreover, a page break is triggered first if necessary (in case automatic page breaking is enabled)
+and, after the call, the current ordinate is moved to the bottom of the image.
+
+
w
+
+Width of the image in the page. There are three cases:
+
+
If the value is positive, it represents the width in user unit
+
If the value is negative, the absolute value represents the horizontal resolution in dpi
+
If the value is not specified or equal to zero, it is automatically calculated
+
+
+
h
+
+Height of the image in the page. There are three cases:
+
+
If the value is positive, it represents the height in user unit
+
If the value is negative, the absolute value represents the vertical resolution in dpi
+
If the value is not specified or equal to zero, it is automatically calculated
+
+
+
type
+
+Image format. Possible values are (case insensitive): JPG, JPEG, PNG and GIF.
+If not specified, the type is inferred from the file extension.
+
+
link
+
+URL or identifier returned by AddLink().
+
+
+
Example
+
+
// Insert a logo in the top-left corner at 300 dpi
+$pdf->Image('logo.png',10,10,-300);
+// Insert a dynamic image from a URL
+$pdf->Image('http://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World',60,30,90,0,'PNG');
+AcceptPageBreak - accept or not automatic page break
+AddFont - add a new font
+AddLink - create an internal link
+AddPage - add a new page
+AliasNbPages - define an alias for number of pages
+Cell - print a cell
+Close - terminate the document
+Error - fatal error
+Footer - page footer
+FPDF - constructor
+GetStringWidth - compute string length
+GetX - get current x position
+GetY - get current y position
+Header - page header
+Image - output an image
+Line - draw a line
+Link - put a link
+Ln - line break
+MultiCell - print text with line breaks
+Output - save or send the document
+PageNo - page number
+Rect - draw a rectangle
+SetAuthor - set the document author
+SetAutoPageBreak - set the automatic page breaking mode
+SetCompression - turn compression on or off
+SetCreator - set document creator
+SetDisplayMode - set display mode
+SetDrawColor - set drawing color
+SetFillColor - set filling color
+SetFont - set font
+SetFontSize - set font size
+SetKeywords - associate keywords with document
+SetLeftMargin - set left margin
+SetLineWidth - set line width
+SetLink - set internal link destination
+SetMargins - set margins
+SetRightMargin - set right margin
+SetSubject - set document subject
+SetTextColor - set text color
+SetTitle - set document title
+SetTopMargin - set top margin
+SetX - set current x position
+SetXY - set current x and y positions
+SetY - set current y position
+Text - print a string
+Write - print flowing text
+
+
diff --git a/3.0/modules/proofsheet/lib/fpdf/doc/line.htm b/3.0/modules/proofsheet/lib/fpdf/doc/line.htm
new file mode 100644
index 00000000..a9c5194c
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/doc/line.htm
@@ -0,0 +1,38 @@
+
+
+
+
+Line
+
+
+
+
+Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(),
+Write() or Image(), but this method can be useful for instance to define a clickable area inside
+an image.
+
Parameters
+
+
x
+
+Abscissa of the upper-left corner of the rectangle.
+
+
y
+
+Ordinate of the upper-left corner of the rectangle.
+
+This method allows printing text with line breaks. They can be automatic (as soon as the
+text reaches the right border of the cell) or explicit (via the \n character). As many cells
+as necessary are output, one below the other.
+
+Text can be aligned, centered or justified. The cell block can be framed and the background
+painted.
+
Parameters
+
+
w
+
+Width of cells. If 0, they extend up to the right margin of the page.
+
+
h
+
+Height of cells.
+
+
txt
+
+String to print.
+
+
border
+
+Indicates if borders must be drawn around the cell block. The value can be either a number:
+
+
0: no border
+
1: frame
+
+or a string containing some or all of the following characters (in any order):
+
+
L: left
+
T: top
+
R: right
+
B: bottom
+
+Default value: 0.
+
+
align
+
+Sets the text alignment. Possible values are:
+
+
L: left alignment
+
C: center
+
R: right alignment
+
J: justification (default value)
+
+
+
fill
+
+Indicates if the cell background must be painted (true) or transparent (false).
+Default value: false.
+
+Send the document to a given destination: browser, file or string. In the case of browser, the
+plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.
+
+The method first calls Close() if necessary to terminate the document.
+
Parameters
+
+
name
+
+The name of the file. If not specified, the document will be sent to the browser
+(destination I) with the name doc.pdf.
+
+
dest
+
+Destination where to send the document. It can take one of the following values:
+
+
I: send the file inline to the browser. The plug-in is used if available.
+The name given by name is used when one selects the "Save as" option on the
+link generating the PDF.
+
D: send to the browser and force a file download with the name given by
+name.
+
F: save to a local file with the name given by name (may include a path).
+
S: return the document as a string. name is ignored.
+SetAutoPageBreak(boolean auto [, float margin])
+
Description
+Enables or disables the automatic page breaking mode. When enabling, the second parameter is
+the distance from the bottom of the page that defines the triggering limit. By default, the
+mode is on and the margin is 2 cm.
+
Parameters
+
+
auto
+
+Boolean indicating if mode should be on or off.
+
+Activates or deactivates page compression. When activated, the internal representation of
+each page is compressed, which leads to a compression ratio of about 2 for the resulting
+document.
+
+Compression is on by default.
+
+
+Note: the Zlib extension is required for this feature. If not present, compression
+will be turned off.
+
Parameters
+
+
compress
+
+Boolean indicating if compression must be enabled.
+
+Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be
+displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a
+specific zooming factor or use viewer default (configured in the Preferences menu of Adobe Reader).
+The page layout can be specified too: single at once, continuous display, two columns or viewer
+default.
+
Parameters
+
+
zoom
+
+The zoom to use. It can be one of the following string values:
+
+
fullpage: displays the entire page on screen
+
fullwidth: uses maximum width of window
+
real: uses real size (equivalent to 100% zoom)
+
default: uses viewer default mode
+
+or a number indicating the zooming factor to use.
+
+Defines the color used for all drawing operations (lines, rectangles and cell borders). It
+can be expressed in RGB components or gray scale. The method can be called before the first
+page is created and the value is retained from page to page.
+
Parameters
+
+
r
+
+If g et b are given, red component; if not, indicates the gray level.
+Value between 0 and 255.
+
+Defines the color used for all filling operations (filled rectangles and cell backgrounds).
+It can be expressed in RGB components or gray scale. The method can be called before the first
+page is created and the value is retained from page to page.
+
Parameters
+
+
r
+
+If g and b are given, red component; if not, indicates the gray level.
+Value between 0 and 255.
+
+SetFont(string family [, string style [, float size]])
+
Description
+Sets the font used to print character strings. It is mandatory to call this method
+at least once before printing text or the resulting document would not be valid.
+
+The font can be either a standard one or a font added via the AddFont() method. Standard fonts
+use the Windows encoding cp1252 (Western Europe).
+
+The method can be called before the first page is created and the font is kept from page
+to page.
+
+If you just wish to change the current font size, it is simpler to call SetFontSize().
+
+
+Note: the font definition files must be accessible. They are searched successively in:
+
+
The directory defined by the FPDF_FONTPATH constant (if this constant is defined)
+
The font directory located in the same directory as fpdf.php (if it exists)
+If the file corresponding to the requested font is not found, the error "Could not include font
+definition file" is raised.
+
Parameters
+
+
family
+
+Family font. It can be either a name defined by AddFont() or one of the standard families (case
+insensitive):
+
+
Courier (fixed-width)
+
Helvetica or Arial (synonymous; sans serif)
+
Times (serif)
+
Symbol (symbolic)
+
ZapfDingbats (symbolic)
+
+It is also possible to pass an empty string. In that case, the current family is kept.
+
+
style
+
+Font style. Possible values are (case insensitive):
+
+
empty string: regular
+
B: bold
+
I: italic
+
U: underline
+
+or any combination. The default value is regular.
+Bold and italic styles do not apply to Symbol and ZapfDingbats.
+
+
size
+
+Font size in points.
+
+The default value is the current size. If no size has been specified since the beginning of
+the document, the value taken is 12.
+
+
+
Example
+
+
// Times regular 12
+$pdf->SetFont('Times');
+// Arial bold 14
+$pdf->SetFont('Arial','B',14);
+// Removes bold
+$pdf->SetFont('');
+// Times bold, italic and underlined 14
+$pdf->SetFont('Times','BIU');
+Defines the left margin. The method can be called before creating the first page.
+
+If the current abscissa gets out of page, it is brought back to the margin.
+
+Defines the line width. By default, the value equals 0.2 mm. The method can be called before
+the first page is created and the value is retained from page to page.
+
+Defines the color used for text. It can be expressed in RGB components or gray scale. The
+method can be called before the first page is created and the value is retained from page to
+page.
+
Parameters
+
+
r
+
+If g et b are given, red component; if not, indicates the gray level.
+Value between 0 and 255.
+
+Defines the abscissa and ordinate of the current position. If the passed values are negative,
+they are relative respectively to the right and bottom of the page.
+
+Moves the current abscissa back to the left margin and sets the ordinate. If the passed value
+is negative, it is relative to the bottom of the page.
+
+Prints a character string. The origin is on the left of the first character, on the baseline.
+This method allows to place a string precisely on the page, but it is usually easier to use
+Cell(), MultiCell() or Write() which are the standard methods to print text.
+
+This method prints text from the current position. When the right margin is reached (or the \n
+character is met) a line break occurs and text continues from the left margin. Upon method exit,
+the current position is left just at the end of the text.
+
+It is possible to put a link on the text.
+
Parameters
+
+
h
+
+Line height.
+
+
txt
+
+String to print.
+
+
link
+
+URL or identifier returned by AddLink().
+
+
+
Example
+
+
// Begin with regular font
+$pdf->SetFont('Arial','',14);
+$pdf->Write(5,'Visit ');
+// Then put a blue underlined link
+$pdf->SetTextColor(0,0,255);
+$pdf->SetFont('','U');
+$pdf->Write(5,'www.fpdf.org','http://www.fpdf.org');
+After including the library file, we create an FPDF object.
+The FPDF() constructor is used here with the default values: pages are in A4 portrait and
+the unit of measure is millimeter. It could have been specified explicitly with:
+
+
$pdf = new FPDF('P','mm','A4');
+
+
+It's possible to use landscape (L), other page sizes (such as Letter and
+Legal) and units (pt, cm, in).
+
+
+There's no page at the moment, so we have to add one with AddPage(). The origin
+is at the upper-left corner and the current position is by default set at 1 cm from the
+borders; the margins can be changed with SetMargins().
+
+
+Before we can print text, it's mandatory to select a font with SetFont(), otherwise the
+document would be invalid. We choose Arial bold 16:
+
+
$pdf->SetFont('Arial','B',16);
+
+
+We could have specified italics with I, underlined with U or a regular font with an empty string
+(or any combination). Note that the font size is given in points, not millimeters (or another user
+unit); it's the only exception. The other standard fonts are Times, Courier, Symbol and ZapfDingbats.
+
+
+We can now print a cell with Cell(). A cell is a rectangular area, possibly framed,
+which contains a line of text. It is output at the current position. We specify its dimensions,
+its text (centered or aligned), if borders should be drawn, and where the current position
+moves after it (to the right, below or to the beginning of the next line). To add a frame, we would do this:
+
+
$pdf->Cell(40,10,'Hello World !',1);
+
+
+To add a new cell next to it with centered text and go to the next line, we would do:
+
+
$pdf->Cell(60,10,'Powered by FPDF.',0,1,'C');
+
+
+Remark: the line break can also be done with Ln(). This method additionnaly allows to specify
+the height of the break.
+
+
+Finally, the document is closed and sent to the browser with Output(). We could have saved
+it to a file by passing the desired file name.
+
+
+Caution: in case when the PDF is sent to the browser, nothing else must be output by the
+script, neither before nor after (no HTML, not even a space or a carriage return). If you send something
+before, you will get the error message: "Some data has already been output, can't send PDF file". If you
+send something after, the document might not display.
+
+
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto1.php b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto1.php
new file mode 100644
index 00000000..14a05046
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto1.php
@@ -0,0 +1,9 @@
+AddPage();
+$pdf->SetFont('Arial','B',16);
+$pdf->Cell(40,10,'Hello World!');
+$pdf->Output();
+?>
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto2.htm b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto2.htm
new file mode 100644
index 00000000..b892d1d9
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto2.htm
@@ -0,0 +1,80 @@
+
+
+
+
+Header, footer, page break and image
+
+
+
+
Header, footer, page break and image
+Here's a two page example with header, footer and logo:
+
+
<?php
+require('fpdf.php');
+
+class PDF extends FPDF
+{
+// Page header
+function Header()
+{
+ // Logo
+ $this->Image('logo.png',10,6,30);
+ // Arial bold 15
+ $this->SetFont('Arial','B',15);
+ // Move to the right
+ $this->Cell(80);
+ // Title
+ $this->Cell(30,10,'Title',1,0,'C');
+ // Line break
+ $this->Ln(20);
+}
+
+// Page footer
+function Footer()
+{
+ // Position at 1.5 cm from bottom
+ $this->SetY(-15);
+ // Arial italic 8
+ $this->SetFont('Arial','I',8);
+ // Page number
+ $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
+}
+}
+
+// Instanciation of inherited class
+$pdf = new PDF();
+$pdf->AliasNbPages();
+$pdf->AddPage();
+$pdf->SetFont('Times','',12);
+for($i=1;$i<=40;$i++)
+ $pdf->Cell(0,10,'Printing line number '.$i,0,1);
+$pdf->Output();
+?>
+This example makes use of the Header() and Footer() methods to process page headers and
+footers. They are called automatically. They already exist in the FPDF class but do nothing,
+therefore we have to extend the class and override them.
+
+
+The logo is printed with the Image() method by specifying its upper-left corner and
+its width. The height is calculated automatically to respect the image proportions.
+
+
+To print the page number, a null value is passed as the cell width. It means that the cell
+should extend up to the right margin of the page; this is handy to center text. The current page
+number is returned by the PageNo() method; as for the total number of pages, it's obtained
+via the special value {nb} which is substituted when the document is finished
+(provided you first called AliasNbPages()).
+
+Note the use of the SetY() method which allows to set position at an absolute location in
+the page, starting from the top or the bottom.
+
+
+Another interesting feature is used here: the automatic page breaking. As soon as a cell would
+cross a limit in the page (at 2 centimeters from the bottom by default), a break is issued
+and the font restored. Although the header and footer select their own font (Arial), the body
+continues with Times. This mechanism of automatic restoration also applies to colors and line
+width. The limit which triggers page breaks can be set with SetAutoPageBreak().
+
+
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto2.php b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto2.php
new file mode 100644
index 00000000..cc7d51c7
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto2.php
@@ -0,0 +1,41 @@
+Image('logo.png',10,6,30);
+ // Arial bold 15
+ $this->SetFont('Arial','B',15);
+ // Move to the right
+ $this->Cell(80);
+ // Title
+ $this->Cell(30,10,'Title',1,0,'C');
+ // Line break
+ $this->Ln(20);
+}
+
+// Page footer
+function Footer()
+{
+ // Position at 1.5 cm from bottom
+ $this->SetY(-15);
+ // Arial italic 8
+ $this->SetFont('Arial','I',8);
+ // Page number
+ $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
+}
+}
+
+// Instanciation of inherited class
+$pdf = new PDF();
+$pdf->AliasNbPages();
+$pdf->AddPage();
+$pdf->SetFont('Times','',12);
+for($i=1;$i<=40;$i++)
+ $pdf->Cell(0,10,'Printing line number '.$i,0,1);
+$pdf->Output();
+?>
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto3.htm b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto3.htm
new file mode 100644
index 00000000..fa583078
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto3.htm
@@ -0,0 +1,115 @@
+
+
+
+
+Line breaks and colors
+
+
+
+
Line breaks and colors
+Let's continue with an example which prints justified paragraphs. It also illustrates the use
+of colors.
+
+
<?php
+require('fpdf.php');
+
+class PDF extends FPDF
+{
+function Header()
+{
+ global $title;
+
+ // Arial bold 15
+ $this->SetFont('Arial','B',15);
+ // Calculate width of title and position
+ $w = $this->GetStringWidth($title)+6;
+ $this->SetX((210-$w)/2);
+ // Colors of frame, background and text
+ $this->SetDrawColor(0,80,180);
+ $this->SetFillColor(230,230,0);
+ $this->SetTextColor(220,50,50);
+ // Thickness of frame (1 mm)
+ $this->SetLineWidth(1);
+ // Title
+ $this->Cell($w,9,$title,1,1,'C',true);
+ // Line break
+ $this->Ln(10);
+}
+
+function Footer()
+{
+ // Position at 1.5 cm from bottom
+ $this->SetY(-15);
+ // Arial italic 8
+ $this->SetFont('Arial','I',8);
+ // Text color in gray
+ $this->SetTextColor(128);
+ // Page number
+ $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
+}
+
+function ChapterTitle($num, $label)
+{
+ // Arial 12
+ $this->SetFont('Arial','',12);
+ // Background color
+ $this->SetFillColor(200,220,255);
+ // Title
+ $this->Cell(0,6,"Chapter $num : $label",0,1,'L',true);
+ // Line break
+ $this->Ln(4);
+}
+
+function ChapterBody($file)
+{
+ // Read text file
+ $txt = file_get_contents($file);
+ // Times 12
+ $this->SetFont('Times','',12);
+ // Output justified text
+ $this->MultiCell(0,5,$txt);
+ // Line break
+ $this->Ln();
+ // Mention in italics
+ $this->SetFont('','I');
+ $this->Cell(0,5,'(end of excerpt)');
+}
+
+function PrintChapter($num, $title, $file)
+{
+ $this->AddPage();
+ $this->ChapterTitle($num,$title);
+ $this->ChapterBody($file);
+}
+}
+
+$pdf = new PDF();
+$title = '20000 Leagues Under the Seas';
+$pdf->SetTitle($title);
+$pdf->SetAuthor('Jules Verne');
+$pdf->PrintChapter(1,'A RUNAWAY REEF','20k_c1.txt');
+$pdf->PrintChapter(2,'THE PROS AND CONS','20k_c2.txt');
+$pdf->Output();
+?>
+The GetStringWidth() method allows to determine the length of a string in the current font,
+which is used here to calculate the position and the width of the frame surrounding the title.
+Then colors are set (via SetDrawColor(), SetFillColor() and SetTextColor()) and the
+thickness of the line is set to 1 mm (instead of 0.2 by default) with SetLineWidth(). Finally,
+we output the cell (the last parameter true indicates that the background must
+be filled).
+
+
+The method used to print the paragraphs is MultiCell(). Each time a line reaches the
+right extremity of the cell or a carriage return character is met, a line break is issued
+and a new cell automatically created under the current one. Text is justified by default.
+
+
+Two document properties are defined: the title (SetTitle()) and the author (SetAuthor()).
+There are several ways to view them in Adobe Reader. The first one is to open the file directly with
+the reader, go to the File menu and choose the Properties option. The second one, also available from
+the plug-in, is to right-click and select Document Properties. The third method is to type the Ctrl+D
+key combination.
+
+
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto3.php b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto3.php
new file mode 100644
index 00000000..eade51cf
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto3.php
@@ -0,0 +1,81 @@
+SetFont('Arial','B',15);
+ // Calculate width of title and position
+ $w = $this->GetStringWidth($title)+6;
+ $this->SetX((210-$w)/2);
+ // Colors of frame, background and text
+ $this->SetDrawColor(0,80,180);
+ $this->SetFillColor(230,230,0);
+ $this->SetTextColor(220,50,50);
+ // Thickness of frame (1 mm)
+ $this->SetLineWidth(1);
+ // Title
+ $this->Cell($w,9,$title,1,1,'C',true);
+ // Line break
+ $this->Ln(10);
+}
+
+function Footer()
+{
+ // Position at 1.5 cm from bottom
+ $this->SetY(-15);
+ // Arial italic 8
+ $this->SetFont('Arial','I',8);
+ // Text color in gray
+ $this->SetTextColor(128);
+ // Page number
+ $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
+}
+
+function ChapterTitle($num, $label)
+{
+ // Arial 12
+ $this->SetFont('Arial','',12);
+ // Background color
+ $this->SetFillColor(200,220,255);
+ // Title
+ $this->Cell(0,6,"Chapter $num : $label",0,1,'L',true);
+ // Line break
+ $this->Ln(4);
+}
+
+function ChapterBody($file)
+{
+ // Read text file
+ $txt = file_get_contents($file);
+ // Times 12
+ $this->SetFont('Times','',12);
+ // Output justified text
+ $this->MultiCell(0,5,$txt);
+ // Line break
+ $this->Ln();
+ // Mention in italics
+ $this->SetFont('','I');
+ $this->Cell(0,5,'(end of excerpt)');
+}
+
+function PrintChapter($num, $title, $file)
+{
+ $this->AddPage();
+ $this->ChapterTitle($num,$title);
+ $this->ChapterBody($file);
+}
+}
+
+$pdf = new PDF();
+$title = '20000 Leagues Under the Seas';
+$pdf->SetTitle($title);
+$pdf->SetAuthor('Jules Verne');
+$pdf->PrintChapter(1,'A RUNAWAY REEF','20k_c1.txt');
+$pdf->PrintChapter(2,'THE PROS AND CONS','20k_c2.txt');
+$pdf->Output();
+?>
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto4.htm b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto4.htm
new file mode 100644
index 00000000..c4a4eb8e
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto4.htm
@@ -0,0 +1,134 @@
+
+
+
+
+Multi-columns
+
+
+
+
Multi-columns
+This example is a variant of the previous one showing how to lay the text across multiple
+columns.
+
+
<?php
+require('fpdf.php');
+
+class PDF extends FPDF
+{
+// Current column
+var $col = 0;
+// Ordinate of column start
+var $y0;
+
+function Header()
+{
+ // Page header
+ global $title;
+
+ $this->SetFont('Arial','B',15);
+ $w = $this->GetStringWidth($title)+6;
+ $this->SetX((210-$w)/2);
+ $this->SetDrawColor(0,80,180);
+ $this->SetFillColor(230,230,0);
+ $this->SetTextColor(220,50,50);
+ $this->SetLineWidth(1);
+ $this->Cell($w,9,$title,1,1,'C',true);
+ $this->Ln(10);
+ // Save ordinate
+ $this->y0 = $this->GetY();
+}
+
+function Footer()
+{
+ // Page footer
+ $this->SetY(-15);
+ $this->SetFont('Arial','I',8);
+ $this->SetTextColor(128);
+ $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
+}
+
+function SetCol($col)
+{
+ // Set position at a given column
+ $this->col = $col;
+ $x = 10+$col*65;
+ $this->SetLeftMargin($x);
+ $this->SetX($x);
+}
+
+function AcceptPageBreak()
+{
+ // Method accepting or not automatic page break
+ if($this->col<2)
+ {
+ // Go to next column
+ $this->SetCol($this->col+1);
+ // Set ordinate to top
+ $this->SetY($this->y0);
+ // Keep on page
+ return false;
+ }
+ else
+ {
+ // Go back to first column
+ $this->SetCol(0);
+ // Page break
+ return true;
+ }
+}
+
+function ChapterTitle($num, $label)
+{
+ // Title
+ $this->SetFont('Arial','',12);
+ $this->SetFillColor(200,220,255);
+ $this->Cell(0,6,"Chapter $num : $label",0,1,'L',true);
+ $this->Ln(4);
+ // Save ordinate
+ $this->y0 = $this->GetY();
+}
+
+function ChapterBody($file)
+{
+ // Read text file
+ $txt = file_get_contents($file);
+ // Font
+ $this->SetFont('Times','',12);
+ // Output text in a 6 cm width column
+ $this->MultiCell(60,5,$txt);
+ $this->Ln();
+ // Mention
+ $this->SetFont('','I');
+ $this->Cell(0,5,'(end of excerpt)');
+ // Go back to first column
+ $this->SetCol(0);
+}
+
+function PrintChapter($num, $title, $file)
+{
+ // Add chapter
+ $this->AddPage();
+ $this->ChapterTitle($num,$title);
+ $this->ChapterBody($file);
+}
+}
+
+$pdf = new PDF();
+$title = '20000 Leagues Under the Seas';
+$pdf->SetTitle($title);
+$pdf->SetAuthor('Jules Verne');
+$pdf->PrintChapter(1,'A RUNAWAY REEF','20k_c1.txt');
+$pdf->PrintChapter(2,'THE PROS AND CONS','20k_c2.txt');
+$pdf->Output();
+?>
+The key method used is AcceptPageBreak(). It allows to accept or not an automatic page
+break. By refusing it and altering the margin and current position, the desired column layout
+is achieved.
+
+For the rest, not many changes; two properties have been added to the class to save the current
+column number and the position where columns begin, and the MultiCell() call specifies a
+6 centimeter width.
+
+
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto4.php b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto4.php
new file mode 100644
index 00000000..360d2375
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto4.php
@@ -0,0 +1,111 @@
+SetFont('Arial','B',15);
+ $w = $this->GetStringWidth($title)+6;
+ $this->SetX((210-$w)/2);
+ $this->SetDrawColor(0,80,180);
+ $this->SetFillColor(230,230,0);
+ $this->SetTextColor(220,50,50);
+ $this->SetLineWidth(1);
+ $this->Cell($w,9,$title,1,1,'C',true);
+ $this->Ln(10);
+ // Save ordinate
+ $this->y0 = $this->GetY();
+}
+
+function Footer()
+{
+ // Page footer
+ $this->SetY(-15);
+ $this->SetFont('Arial','I',8);
+ $this->SetTextColor(128);
+ $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
+}
+
+function SetCol($col)
+{
+ // Set position at a given column
+ $this->col = $col;
+ $x = 10+$col*65;
+ $this->SetLeftMargin($x);
+ $this->SetX($x);
+}
+
+function AcceptPageBreak()
+{
+ // Method accepting or not automatic page break
+ if($this->col<2)
+ {
+ // Go to next column
+ $this->SetCol($this->col+1);
+ // Set ordinate to top
+ $this->SetY($this->y0);
+ // Keep on page
+ return false;
+ }
+ else
+ {
+ // Go back to first column
+ $this->SetCol(0);
+ // Page break
+ return true;
+ }
+}
+
+function ChapterTitle($num, $label)
+{
+ // Title
+ $this->SetFont('Arial','',12);
+ $this->SetFillColor(200,220,255);
+ $this->Cell(0,6,"Chapter $num : $label",0,1,'L',true);
+ $this->Ln(4);
+ // Save ordinate
+ $this->y0 = $this->GetY();
+}
+
+function ChapterBody($file)
+{
+ // Read text file
+ $txt = file_get_contents($file);
+ // Font
+ $this->SetFont('Times','',12);
+ // Output text in a 6 cm width column
+ $this->MultiCell(60,5,$txt);
+ $this->Ln();
+ // Mention
+ $this->SetFont('','I');
+ $this->Cell(0,5,'(end of excerpt)');
+ // Go back to first column
+ $this->SetCol(0);
+}
+
+function PrintChapter($num, $title, $file)
+{
+ // Add chapter
+ $this->AddPage();
+ $this->ChapterTitle($num,$title);
+ $this->ChapterBody($file);
+}
+}
+
+$pdf = new PDF();
+$title = '20000 Leagues Under the Seas';
+$pdf->SetTitle($title);
+$pdf->SetAuthor('Jules Verne');
+$pdf->PrintChapter(1,'A RUNAWAY REEF','20k_c1.txt');
+$pdf->PrintChapter(2,'THE PROS AND CONS','20k_c2.txt');
+$pdf->Output();
+?>
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto5.htm b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto5.htm
new file mode 100644
index 00000000..03fdd543
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto5.htm
@@ -0,0 +1,134 @@
+
+
+
+
+Tables
+
+
+
+
Tables
+This tutorial shows different ways to make tables.
+
+A table being just a collection of cells, it's natural to build one from them. The first
+example is achieved in the most basic way possible: simple framed cells, all of the same size
+and left aligned. The result is rudimentary but very quick to obtain.
+
+
+The second table brings some improvements: each column has its own width, headings are centered,
+and numbers right aligned. Moreover, horizontal lines have been removed. This is done by means
+of the border parameter of the Cell() method, which specifies which sides of the
+cell must be drawn. Here we want the left (L) and right (R) ones. It remains
+the problem of the horizontal line to finish the table. There are two possibilities: either
+check for the last line in the loop, in which case we use LRB for the border
+parameter; or, as done here, add the line once the loop is over.
+
+
+The third table is similar to the second one but uses colors. Fill, text and line colors are
+simply specified. Alternate coloring for rows is obtained by using alternatively transparent
+and filled cells.
+
+
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto5.php b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto5.php
new file mode 100644
index 00000000..f1b64a21
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto5.php
@@ -0,0 +1,102 @@
+Cell(40,7,$col,1);
+ $this->Ln();
+ // Data
+ foreach($data as $row)
+ {
+ foreach($row as $col)
+ $this->Cell(40,6,$col,1);
+ $this->Ln();
+ }
+}
+
+// Better table
+function ImprovedTable($header, $data)
+{
+ // Column widths
+ $w = array(40, 35, 40, 45);
+ // Header
+ for($i=0;$iCell($w[$i],7,$header[$i],1,0,'C');
+ $this->Ln();
+ // Data
+ foreach($data as $row)
+ {
+ $this->Cell($w[0],6,$row[0],'LR');
+ $this->Cell($w[1],6,$row[1],'LR');
+ $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R');
+ $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R');
+ $this->Ln();
+ }
+ // Closing line
+ $this->Cell(array_sum($w),0,'','T');
+}
+
+// Colored table
+function FancyTable($header, $data)
+{
+ // Colors, line width and bold font
+ $this->SetFillColor(255,0,0);
+ $this->SetTextColor(255);
+ $this->SetDrawColor(128,0,0);
+ $this->SetLineWidth(.3);
+ $this->SetFont('','B');
+ // Header
+ $w = array(40, 35, 40, 45);
+ for($i=0;$iCell($w[$i],7,$header[$i],1,0,'C',true);
+ $this->Ln();
+ // Color and font restoration
+ $this->SetFillColor(224,235,255);
+ $this->SetTextColor(0);
+ $this->SetFont('');
+ // Data
+ $fill = false;
+ foreach($data as $row)
+ {
+ $this->Cell($w[0],6,$row[0],'LR',0,'L',$fill);
+ $this->Cell($w[1],6,$row[1],'LR',0,'L',$fill);
+ $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R',$fill);
+ $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R',$fill);
+ $this->Ln();
+ $fill = !$fill;
+ }
+ // Closing line
+ $this->Cell(array_sum($w),0,'','T');
+}
+}
+
+$pdf = new PDF();
+// Column headings
+$header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)');
+// Data loading
+$data = $pdf->LoadData('countries.txt');
+$pdf->SetFont('Arial','',14);
+$pdf->AddPage();
+$pdf->BasicTable($header,$data);
+$pdf->AddPage();
+$pdf->ImprovedTable($header,$data);
+$pdf->AddPage();
+$pdf->FancyTable($header,$data);
+$pdf->Output();
+?>
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto6.htm b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto6.htm
new file mode 100644
index 00000000..2b98d201
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto6.htm
@@ -0,0 +1,165 @@
+
+
+
+
+Links and flowing text
+
+
+
+
Links and flowing text
+This tutorial explains how to insert links (internal and external) and shows a new text writing
+mode. It also contains a basic HTML parser.
+
+
<?php
+require('fpdf.php');
+
+class PDF extends FPDF
+{
+var $B;
+var $I;
+var $U;
+var $HREF;
+
+function PDF($orientation='P', $unit='mm', $size='A4')
+{
+ // Call parent constructor
+ $this->FPDF($orientation,$unit,$size);
+ // Initialization
+ $this->B = 0;
+ $this->I = 0;
+ $this->U = 0;
+ $this->HREF = '';
+}
+
+function WriteHTML($html)
+{
+ // HTML parser
+ $html = str_replace("\n",' ',$html);
+ $a = preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
+ foreach($a as $i=>$e)
+ {
+ if($i%2==0)
+ {
+ // Text
+ if($this->HREF)
+ $this->PutLink($this->HREF,$e);
+ else
+ $this->Write(5,$e);
+ }
+ else
+ {
+ // Tag
+ if($e[0]=='/')
+ $this->CloseTag(strtoupper(substr($e,1)));
+ else
+ {
+ // Extract attributes
+ $a2 = explode(' ',$e);
+ $tag = strtoupper(array_shift($a2));
+ $attr = array();
+ foreach($a2 as $v)
+ {
+ if(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3))
+ $attr[strtoupper($a3[1])] = $a3[2];
+ }
+ $this->OpenTag($tag,$attr);
+ }
+ }
+ }
+}
+
+function OpenTag($tag, $attr)
+{
+ // Opening tag
+ if($tag=='B' || $tag=='I' || $tag=='U')
+ $this->SetStyle($tag,true);
+ if($tag=='A')
+ $this->HREF = $attr['HREF'];
+ if($tag=='BR')
+ $this->Ln(5);
+}
+
+function CloseTag($tag)
+{
+ // Closing tag
+ if($tag=='B' || $tag=='I' || $tag=='U')
+ $this->SetStyle($tag,false);
+ if($tag=='A')
+ $this->HREF = '';
+}
+
+function SetStyle($tag, $enable)
+{
+ // Modify style and select corresponding font
+ $this->$tag += ($enable ? 1 : -1);
+ $style = '';
+ foreach(array('B', 'I', 'U') as $s)
+ {
+ if($this->$s>0)
+ $style .= $s;
+ }
+ $this->SetFont('',$style);
+}
+
+function PutLink($URL, $txt)
+{
+ // Put a hyperlink
+ $this->SetTextColor(0,0,255);
+ $this->SetStyle('U',true);
+ $this->Write(5,$txt,$URL);
+ $this->SetStyle('U',false);
+ $this->SetTextColor(0);
+}
+}
+
+$html = 'You can now easily print text mixing different styles: <b>bold</b>, <i>italic</i>,
+<u>underlined</u>, or <b><i><u>all at once</u></i></b>!<br><br>You can also insert links on
+text, such as <a href="http://www.fpdf.org">www.fpdf.org</a>, or on an image: click on the logo.';
+
+$pdf = new PDF();
+// First page
+$pdf->AddPage();
+$pdf->SetFont('Arial','',20);
+$pdf->Write(5,"To find out what's new in this tutorial, click ");
+$pdf->SetFont('','U');
+$link = $pdf->AddLink();
+$pdf->Write(5,'here',$link);
+$pdf->SetFont('');
+// Second page
+$pdf->AddPage();
+$pdf->SetLink($link);
+$pdf->Image('logo.png',10,12,30,0,'','http://www.fpdf.org');
+$pdf->SetLeftMargin(45);
+$pdf->SetFontSize(14);
+$pdf->WriteHTML($html);
+$pdf->Output();
+?>
+The new method to print text is Write(). It's very close to MultiCell(); the differences are:
+
+
The end of line is at the right margin and the next line begins at the left one
+
The current position moves at the end of the text
+
+So it allows to write a chunk of text, alter the font style, then continue from the exact
+place we left it. On the other hand, you cannot justify it.
+
+
+The method is used on the first page to put a link pointing to the second one. The beginning of
+the sentence is written in regular style, then we switch to underline and finish it. The link
+is created with AddLink(), which returns a link identifier. The identifier is
+passed as third parameter of Write(). Once the second page is created, we use SetLink() to
+make the link point to the beginning of the current page.
+
+
+Then we put an image with an external link on it. An external link is just a URL. It's passed as
+last parameter of Image().
+
+
+Finally, the left margin is moved after the image with SetLeftMargin() and some text in
+HTML format is output. A very simple HTML parser is used for this, based on regular expressions.
+Recognized tags are <b>, <i>, <u>, <a> and <br>; the others are
+ignored. The parser also makes use of the Write() method. An external link is put the same way as
+an internal one (third parameter of Write()). Note that Cell() also allows to put links.
+
+
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto6.php b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto6.php
new file mode 100644
index 00000000..88fdd513
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto6.php
@@ -0,0 +1,124 @@
+FPDF($orientation,$unit,$size);
+ // Initialization
+ $this->B = 0;
+ $this->I = 0;
+ $this->U = 0;
+ $this->HREF = '';
+}
+
+function WriteHTML($html)
+{
+ // HTML parser
+ $html = str_replace("\n",' ',$html);
+ $a = preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
+ foreach($a as $i=>$e)
+ {
+ if($i%2==0)
+ {
+ // Text
+ if($this->HREF)
+ $this->PutLink($this->HREF,$e);
+ else
+ $this->Write(5,$e);
+ }
+ else
+ {
+ // Tag
+ if($e[0]=='/')
+ $this->CloseTag(strtoupper(substr($e,1)));
+ else
+ {
+ // Extract attributes
+ $a2 = explode(' ',$e);
+ $tag = strtoupper(array_shift($a2));
+ $attr = array();
+ foreach($a2 as $v)
+ {
+ if(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3))
+ $attr[strtoupper($a3[1])] = $a3[2];
+ }
+ $this->OpenTag($tag,$attr);
+ }
+ }
+ }
+}
+
+function OpenTag($tag, $attr)
+{
+ // Opening tag
+ if($tag=='B' || $tag=='I' || $tag=='U')
+ $this->SetStyle($tag,true);
+ if($tag=='A')
+ $this->HREF = $attr['HREF'];
+ if($tag=='BR')
+ $this->Ln(5);
+}
+
+function CloseTag($tag)
+{
+ // Closing tag
+ if($tag=='B' || $tag=='I' || $tag=='U')
+ $this->SetStyle($tag,false);
+ if($tag=='A')
+ $this->HREF = '';
+}
+
+function SetStyle($tag, $enable)
+{
+ // Modify style and select corresponding font
+ $this->$tag += ($enable ? 1 : -1);
+ $style = '';
+ foreach(array('B', 'I', 'U') as $s)
+ {
+ if($this->$s>0)
+ $style .= $s;
+ }
+ $this->SetFont('',$style);
+}
+
+function PutLink($URL, $txt)
+{
+ // Put a hyperlink
+ $this->SetTextColor(0,0,255);
+ $this->SetStyle('U',true);
+ $this->Write(5,$txt,$URL);
+ $this->SetStyle('U',false);
+ $this->SetTextColor(0);
+}
+}
+
+$html = 'You can now easily print text mixing different styles: bold, italic,
+underlined, or all at once!
You can also insert links on
+text, such as www.fpdf.org, or on an image: click on the logo.';
+
+$pdf = new PDF();
+// First page
+$pdf->AddPage();
+$pdf->SetFont('Arial','',20);
+$pdf->Write(5,"To find out what's new in this tutorial, click ");
+$pdf->SetFont('','U');
+$link = $pdf->AddLink();
+$pdf->Write(5,'here',$link);
+$pdf->SetFont('');
+// Second page
+$pdf->AddPage();
+$pdf->SetLink($link);
+$pdf->Image('logo.png',10,12,30,0,'','http://www.fpdf.org');
+$pdf->SetLeftMargin(45);
+$pdf->SetFontSize(14);
+$pdf->WriteHTML($html);
+$pdf->Output();
+?>
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto7.htm b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto7.htm
new file mode 100644
index 00000000..21a3f6ed
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto7.htm
@@ -0,0 +1,241 @@
+
+
+
+
+Adding new fonts and encoding support
+
+
+
+
+
Adding new fonts and encoding support
+This tutorial explains how to use TrueType, OpenType and Type1 fonts so that you are not limited to
+the standard fonts any more. The other benefit is that you can choose the font encoding, which allows
+you to use other languages than the Western ones (the standard fonts having too few available characters).
+
+
+Remark: for OpenType, only the format based on TrueType is supported (not the one based on Type1).
+
+
+There are two ways to use a new font: embedding it in the PDF or not. When a font is not
+embedded, it is searched in the system. The advantage is that the PDF file is lighter; on the other
+hand, if it's not available, a substitution font is used. So it's preferable to ensure that the
+needed font is installed on the client systems. If the file is to be viewed by a large audience,
+it's highly recommended to embed.
+
+
+Adding a new font requires two steps:
+
+
Generation of the font definition file
+
Declaration of the font in the script
+
+For Type1, you need the corresponding AFM file. It's usually provided with the font.
+
+
Generation of the font definition file
+The first step consists in generating a PHP file containing all the information needed by FPDF;
+in addition, the font file is compressed. To do this, a helper script is provided in the makefont
+directory of the package: makefont.php. It contains the following function:
+
+
+MakeFont(string fontfile, [, string enc [, boolean embed]])
+
+
fontfile
+
+
Path to the .ttf, .otf or .pfb file.
+
+
enc
+
+
Name of the encoding to use. Default value: cp1252.
+
+
embed
+
+
Whether to embed the font or not. Default value: true.
+
+
+The first parameter is the name of the font file. The extension must be either .ttf, .otf or .pfb and
+determines the font type. If your Type1 font is in ASCII format (.pfa), you can convert it to binary
+(.pfb) with the help of t1utils.
+
+
+For Type1 fonts, the corresponding .afm file must be present in the same directory.
+
+
+The encoding defines the association between a code (from 0 to 255) and a character. The first 128 are
+always the same and correspond to ASCII; the following are variable. Encodings are stored in .map
+files. The available ones are:
+
+
cp1250 (Central Europe)
+
cp1251 (Cyrillic)
+
cp1252 (Western Europe)
+
cp1253 (Greek)
+
cp1254 (Turkish)
+
cp1255 (Hebrew)
+
cp1257 (Baltic)
+
cp1258 (Vietnamese)
+
cp874 (Thai)
+
ISO-8859-1 (Western Europe)
+
ISO-8859-2 (Central Europe)
+
ISO-8859-4 (Baltic)
+
ISO-8859-5 (Cyrillic)
+
ISO-8859-7 (Greek)
+
ISO-8859-9 (Turkish)
+
ISO-8859-11 (Thai)
+
ISO-8859-15 (Western Europe)
+
ISO-8859-16 (Central Europe)
+
KOI8-R (Russian)
+
KOI8-U (Ukrainian)
+
+Of course, the font must contain the characters corresponding to the chosen encoding.
+
+
+Remark: the standard fonts use cp1252.
+
+
+After you have called the function (create a new file for this and include makefont.php), a .php file
+is created, with the same name as the font file. You may rename it if you wish. If the case of embedding,
+the font file is compressed and gives a second file with .z as extension (except if the compression
+function is not available, it requires Zlib). You may rename it too, but in this case you have to change
+the variable $file in the .php file accordingly.
+
+
+Example:
+
+which gives the files comic.php and comic.z.
+
+
+Then copy the generated files to the font directory. If the font file could not be compressed, copy
+it directly instead of the .z version.
+
+
+Another way to call MakeFont() is through the command line:
+
+
+php makefont\makefont.php c:\Windows\Fonts\comic.ttf cp1252
+
+
+Finally, for TrueType and OpenType fonts, you can also generate the files
+online instead of doing it manually.
+
+
Declaration of the font in the script
+The second step is simple. You just need to call the AddFont() method:
+
+
$pdf->AddFont('Comic','','comic.php');
+
+
+And the font is now available (in regular and underlined styles), usable like the others. If we
+had worked with Comic Sans MS Bold (comicbd.ttf), we would have written:
+
+
$pdf->AddFont('Comic','B','comicbd.php');
+
+
+
+
Example
+Let's now see a complete example. We will use the font Calligrapher.
+The first step is the generation of the font files:
+
+The script gives the following report:
+
+
+Warning: character Euro is missing
+Warning: character zcaron is missing
+Font file compressed: calligra.z
+Font definition file generated: calligra.php
+
+The euro character is not present in the font (it's too old). Another character is missing too.
+
+
+Alternatively we could have used the command line:
+
+
+php makefont\makefont.php calligra.ttf cp1252
+
+
+or used the online generator.
+
+
+We can now copy the two generated files to the font directory and write the script:
+
+
<?php
+require('fpdf.php');
+
+$pdf = new FPDF();
+$pdf->AddFont('Calligrapher','','calligra.php');
+$pdf->AddPage();
+$pdf->SetFont('Calligrapher','',35);
+$pdf->Write(10,'Enjoy new fonts with FPDF!');
+$pdf->Output();
+?>
+The euro character is not present in all encodings, and is not always placed at the same position:
+
+
Encoding
Position
+
cp1250
128
+
cp1251
136
+
cp1252
128
+
cp1253
128
+
cp1254
128
+
cp1255
128
+
cp1257
128
+
cp1258
128
+
cp874
128
+
ISO-8859-1
N/A
+
ISO-8859-2
N/A
+
ISO-8859-4
N/A
+
ISO-8859-5
N/A
+
ISO-8859-7
N/A
+
ISO-8859-9
N/A
+
ISO-8859-11
N/A
+
ISO-8859-15
164
+
ISO-8859-16
164
+
KOI8-R
N/A
+
KOI8-U
N/A
+
+ISO-8859-1 is widespread but does not include the euro sign. If you need it, the simplest thing
+to do is to use cp1252 or ISO-8859-15 instead, which are nearly identical but contain the precious
+symbol.
+
+
Reducing the size of TrueType fonts
+Font files are often quite voluminous; this is due to the fact that they contain the characters
+corresponding to many encodings. Zlib compression reduces them but they remain fairly big. A
+technique exists to reduce them further. It consists in converting the font to the Type1 format
+with ttf2pt1 (the Windows binary is
+available here) while specifying the encoding
+you are interested in; all other characters will be discarded.
+
+For example, the arial.ttf font that ships with Windows Vista weights 748 KB (it contains 3381 characters).
+After compression it drops to 411. Let's convert it to Type1 by keeping only cp1250 characters:
+
+
+ttf2pt1 -b -L cp1250.map c:\Windows\Fonts\arial.ttf arial
+
+
+The .map files are located in the makefont directory of the package. The command produces
+arial.pfb and arial.afm. The arial.pfb file weights only 57 KB, and 53 after compression.
+
+
+It's possible to go even further. If you are interested only by a subset of the encoding (you
+probably don't need all 217 characters), you can open the .map file and remove the lines you are
+not interested in. This will reduce the file size accordingly.
+
+
diff --git a/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto7.php b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto7.php
new file mode 100644
index 00000000..d1127f37
--- /dev/null
+++ b/3.0/modules/proofsheet/lib/fpdf/tutorial/tuto7.php
@@ -0,0 +1,11 @@
+AddFont('Calligrapher','','calligra.php');
+$pdf->AddPage();
+$pdf->SetFont('Calligrapher','',35);
+$pdf->Cell(0,10,'Enjoy new fonts with FPDF!');
+$pdf->Output();
+?>
diff --git a/3.0/modules/proofsheet/module.info b/3.0/modules/proofsheet/module.info
new file mode 100644
index 00000000..fec62944
--- /dev/null
+++ b/3.0/modules/proofsheet/module.info
@@ -0,0 +1,7 @@
+name = "ProofSheet"
+description = "Displays links to generate a PDF proof sheet of the current album in A4 or LTR size."
+version = 5
+author_name = "Shad Laws"
+author_url = ""
+info_url = "http://codex.gallery2.org/Gallery3:Modules:proofsheet"
+discuss_url = "http://gallery.menalto.com/node/105856"
diff --git a/3.0/modules/short_search_fix/controllers/admin_short_search_fix.php b/3.0/modules/short_search_fix/controllers/admin_short_search_fix.php
new file mode 100644
index 00000000..a5620e89
--- /dev/null
+++ b/3.0/modules/short_search_fix/controllers/admin_short_search_fix.php
@@ -0,0 +1,63 @@
+page_title = t("Short search fix settings");
+ $view->content = new View("admin_short_search_fix.html");
+ $view->content->form = $this->_get_admin_form();
+ print $view;
+ }
+
+ public function save() {
+ access::verify_csrf();
+ $form = $this->_get_admin_form();
+ $form->validate();
+ module::set_var("short_search_fix", "search_prefix",
+ $form->short_search_fix_settings->search_prefix->value);
+ message::success(t("Short search fix settings updated"));
+ if ($form->short_search_fix_settings->mark_rebuild_search_records->value) {
+ $db = Database::instance();
+ $db->query("UPDATE {search_records} SET dirty=1;");
+ }
+ if ($form->short_search_fix_settings->mark_uptodate_search_records->value) {
+ $db = Database::instance();
+ $db->query("UPDATE {search_records} SET dirty=0;");
+ }
+ url::redirect("admin/short_search_fix");
+ }
+
+ private function _get_admin_form() {
+ $form = new Forge("admin/short_search_fix/save", "", "post",
+ array("id" => "g-short-search-fix-admin-form"));
+ $short_search_fix_settings = $form->group("short_search_fix_settings")->label(t("Prefix and search record rebuild"));
+ $short_search_fix_settings->input("search_prefix")
+ ->label(t("Enter the prefix to be added to the start of every search word (Default: 1Z)"))
+ ->value(module::get_var("short_search_fix", "search_prefix"));
+ $short_search_fix_settings->checkbox("mark_rebuild_search_records")
+ ->label(t("Mark all search records for rebuild. This is needed when the prefix is changed. Afterward, go to Maintenace | Update search records."))
+ ->checked(false);
+ $short_search_fix_settings->checkbox("mark_uptodate_search_records")
+ ->label(t("Mark all search records as up-to-date. This is a pseudo-undo of the above."))
+ ->checked(false);
+ $short_search_fix_settings->submit("save")->value(t("Save"));
+ return $form;
+ }
+}
\ No newline at end of file
diff --git a/3.0/modules/short_search_fix/helpers/MY_search.php b/3.0/modules/short_search_fix/helpers/MY_search.php
new file mode 100644
index 00000000..8e4b8830
--- /dev/null
+++ b/3.0/modules/short_search_fix/helpers/MY_search.php
@@ -0,0 +1,58 @@
+ 0) {
+ $terms = ' ' . $terms;
+ $terms = str_replace(' ', ' '.$prefix, $terms);
+ $terms = str_replace(' '.$prefix.'"', ' '.'"'.$prefix, $terms);
+ $terms = substr($terms,1);
+ }
+ return $terms;
+ }
+}
diff --git a/3.0/modules/short_search_fix/helpers/short_search_fix_event.php b/3.0/modules/short_search_fix/helpers/short_search_fix_event.php
new file mode 100644
index 00000000..db418ebd
--- /dev/null
+++ b/3.0/modules/short_search_fix/helpers/short_search_fix_event.php
@@ -0,0 +1,45 @@
+get("settings_menu")
+ ->append(Menu::factory("link")
+ ->id("short_search_fix")
+ ->label(t("Short search fix"))
+ ->url(url::site("admin/short_search_fix")));
+ }
+
+ // This is the function that changes what's written to the search_records database
+ static function item_index_data($item, $data) {
+ $prefix = module::get_var("short_search_fix","search_prefix");
+ foreach ($data as &$terms) {
+ // strip leading, trailing, and extra whitespaces
+ $terms = preg_replace('/^\s+/', '', $terms);
+ $terms = preg_replace('/\s+$/', '', $terms);
+ $terms = preg_replace('/\s\s+/', ' ', $terms);
+ // add the prefixes
+ if (preg_match('/\w/',$terms) > 0) {
+ $terms = $prefix . str_replace(' ', ' '.$prefix, $terms);
+ }
+ }
+ }
+
+}
diff --git a/3.0/modules/short_search_fix/helpers/short_search_fix_installer.php b/3.0/modules/short_search_fix/helpers/short_search_fix_installer.php
new file mode 100644
index 00000000..1db9cb27
--- /dev/null
+++ b/3.0/modules/short_search_fix/helpers/short_search_fix_installer.php
@@ -0,0 +1,41 @@
+query("UPDATE {search_records} SET dirty=1;");
+ }
+
+ static function deactivate() {
+ $db = Database::instance();
+ $db->query("UPDATE {search_records} SET dirty=1;");
+ }
+
+ static function uninstall() {
+ $db = Database::instance();
+ module::clear_var("short_search_fix", "search_prefix");
+ }
+}
diff --git a/3.0/modules/short_search_fix/module.info b/3.0/modules/short_search_fix/module.info
new file mode 100644
index 00000000..b24d10d2
--- /dev/null
+++ b/3.0/modules/short_search_fix/module.info
@@ -0,0 +1,7 @@
+name = "Short Search Fix"
+description = "Allows 2-3 letter searches to be performed without requiring SQL system variable modification (useful for shared hosting)."
+version = 1
+author_name = "Shad Laws"
+author_url = ""
+info_url = "http://codex.gallery2.org/Gallery3:Modules:short_search_fix"
+discuss_url = "http://gallery.menalto.com/node/105935"
\ No newline at end of file
diff --git a/3.0/modules/short_search_fix/views/admin_short_search_fix.html.php b/3.0/modules/short_search_fix/views/admin_short_search_fix.html.php
new file mode 100644
index 00000000..81ecea86
--- /dev/null
+++ b/3.0/modules/short_search_fix/views/admin_short_search_fix.html.php
@@ -0,0 +1,10 @@
+
+
+
= t("Short search fix settings") ?>
+
+ = t("This module works by padding every search term with a prefix. Since MySQL system variables typically set the minimum search term to 4 characters, the default 2-character prefix makes all 2-letter searches valid.") ?>
+
+
+ = $form ?>
+
+
diff --git a/3.0/modules/tag_cloud_html5/controllers/admin_tag_cloud_html5.php b/3.0/modules/tag_cloud_html5/controllers/admin_tag_cloud_html5.php
new file mode 100644
index 00000000..e6a6a766
--- /dev/null
+++ b/3.0/modules/tag_cloud_html5/controllers/admin_tag_cloud_html5.php
@@ -0,0 +1,254 @@
+_get_admin_form();
+ $this->_print_screen($form);
+ }
+
+ public function edit() {
+ access::verify_csrf();
+ $cfg = $this->_get_config();
+ $form = $this->_get_admin_form();
+ if ($form->validate()) {
+ if ($form->options_general->load_defaults->value) {
+ // reset all to defaults, redirect with message
+ module::install("tag_cloud_html5");
+ message::success(t("Tag cloud options reset successfully"));
+ url::redirect("admin/tag_cloud_html5");
+ } else {
+ $valid = true;
+ // run checks on various inputs
+ $options_general = $form->options_general;
+ if ($options_general->height_sidebar->value < 0) {
+ $form->options_general->height_sidebar->add_error("not_valid", 1);
+ $valid = false;
+ }
+ foreach ($cfg['groups'] as $groupname => $grouptext) {
+ ${"options".$groupname} = $form->{"options".$groupname};
+ if ($options_general->{"maxtags".$groupname}->value < 0) {
+ $form->options_general->{"maxtags".$groupname}->add_error("not_valid", 1);
+ $valid = false;
+ }
+ if (${"options".$groupname}->{"maxSpeed".$groupname}->value < 0) {
+ $form->{"options".$groupname}->{"maxSpeed".$groupname}->add_error("not_valid", 1);
+ $valid = false;
+ }
+ if ((${"options".$groupname}->{"initialX".$groupname}->value < -1) || (${"options".$groupname}->{"initialX".$groupname}->value > 1)) {
+ $form->{"options".$groupname}->{"initialX".$groupname}->add_error("not_valid", 1);
+ $valid = false;
+ }
+ if ((${"options".$groupname}->{"initialY".$groupname}->value < -1) || (${"options".$groupname}->{"initialY".$groupname}->value > 1)) {
+ $form->{"options".$groupname}->{"initialY".$groupname}->add_error("not_valid", 1);
+ $valid = false;
+ }
+ if ((${"options".$groupname}->{"deadZone".$groupname}->value < 0) || (${"options".$groupname}->{"deadZone".$groupname}->value > 1)) {
+ $form->{"options".$groupname}->{"deadZone".$groupname}->add_error("not_valid", 1);
+ $valid = false;
+ }
+ if (${"options".$groupname}->{"zoom".$groupname}->value < 0) {
+ $form->{"options".$groupname}->{"zoom".$groupname}->add_error("not_valid", 1);
+ $valid = false;
+ }
+ if ((${"options".$groupname}->{"depth".$groupname}->value < 0) || (${"options".$groupname}->{"depth".$groupname}->value > 1)) {
+ $form->{"options".$groupname}->{"depth".$groupname}->add_error("not_valid", 1);
+ $valid = false;
+ }
+ if (${"options".$groupname}->{"outlineOffset".$groupname}->value < 0) {
+ $form->{"options".$groupname}->{"outlineOffset".$groupname}->add_error("not_valid", 1);
+ $valid = false;
+ }
+ if (preg_match("/^#[0-9A-Fa-f]{6}$/", ${"options".$groupname}->{"outlineColour".$groupname}->value) == 0) {
+ $form->{"options".$groupname}->{"outlineColour".$groupname}->add_error("not_valid", 1);
+ $valid = false;
+ }
+ if ((preg_match("/^#[0-9A-Fa-f]{6}$/", ${"options".$groupname}->{"textColour".$groupname}->value) == 0) && (strcmp(${"options".$groupname}->{"textColour".$groupname}->value, "") != 0) ) {
+ $form->{"options".$groupname}->{"textColour".$groupname}->add_error("not_valid", 1);
+ $valid = false;
+ }
+ if (${"options".$groupname}->{"textHeight".$groupname}->value < 0) {
+ $form->{"options".$groupname}->{"textHeight".$groupname}->add_error("not_valid", 1);
+ $valid = false;
+ }
+ }
+ if ($valid) {
+ // all inputs passed tests above; save them
+ module::set_var("tag_cloud_html5", "show_wholecloud_link", ($options_general->show_wholecloud_link->value == 1));
+ module::set_var("tag_cloud_html5", "show_add_tag_form", ($options_general->show_add_tag_form->value == 1));
+ module::set_var("tag_cloud_html5", "height_sidebar", $options_general->height_sidebar->value);
+ module::set_var("tag_cloud_html5", "show_wholecloud_list", ($options_general->show_wholecloud_list->value == 1));
+ foreach ($cfg['groups'] as $groupname => $grouptext) {
+ module::set_var("tag_cloud_html5", "maxtags".$groupname, $options_general->{"maxtags".$groupname}->value);
+
+ $optionsarray = array();
+ $optionsarray['maxSpeed'] = ${"options".$groupname}->{"maxSpeed".$groupname}->value;
+ $optionsarray['deadZone'] = ${"options".$groupname}->{"deadZone".$groupname}->value;
+ $optionsarray['initial'] = array(${"options".$groupname}->{"initialX".$groupname}->value, ${"options".$groupname}->{"initialY".$groupname}->value);
+ $optionsarray['initialDecel'] = (${"options".$groupname}->{"initialDecel".$groupname}->value == 1);
+ $optionsarray['zoom'] = ${"options".$groupname}->{"zoom".$groupname}->value;
+ $optionsarray['depth'] = ${"options".$groupname}->{"depth".$groupname}->value;
+ $optionsarray['outlineMethod'] = ${"options".$groupname}->{"outlineMethod".$groupname}->value;
+ $optionsarray['outlineOffset'] = ${"options".$groupname}->{"outlineOffset".$groupname}->value;
+ $optionsarray['outlineColour'] = ${"options".$groupname}->{"outlineColour".$groupname}->value;
+ $optionsarray['textColour'] = ${"options".$groupname}->{"textColour".$groupname}->value;
+ $optionsarray['textFont'] = ${"options".$groupname}->{"textFont".$groupname}->value;
+ $optionsarray['textHeight'] = ${"options".$groupname}->{"textHeight".$groupname}->value;
+ $optionsarray['frontSelect'] = (${"options".$groupname}->{"frontSelect".$groupname}->value == 1);
+ $optionsarray['wheelZoom'] = false; // note that this is locked - otherwise scrolling through the page screws everything up
+ module::set_var("tag_cloud_html5", "options".$groupname, json_encode($optionsarray));
+ }
+ // all done; redirect with message
+ message::success(t("Tag cloud options updated successfully"));
+ url::redirect("admin/tag_cloud_html5");
+ }
+ }
+ }
+ // print screen from existing form - you wind up here if something wasn't validated
+ $this->_print_screen($form);
+ }
+
+ private function _get_config() {
+ // these define the two variable name groups, along with their labels which are always shown with t() for i18n.
+ $cfg['groups'] = array("_sidebar"=>"Sidebar", "_wholecloud"=>"Whole cloud");
+ // this defines the separator that's used between the group name and the attribute, and is *not* put through t().
+ $cfg['sep'] = ": ";
+ return $cfg;
+ }
+
+ private function _print_screen($form) {
+ $view = new Admin_View("admin.html");
+ $view->content = new View("admin_tag_cloud_html5.html");
+ $view->content->form = $form;
+ print $view;
+ }
+
+ private function _get_admin_form() {
+ $cfg = $this->_get_config();
+ $sep = $cfg['sep'];
+
+ // Make the form. This form has three groups: group_general, group_sidebar, and group_wholecloud.
+ $form = new Forge("admin/tag_cloud_html5/edit", "", "post", array("id" => "g-tag-cloud-html5-admin-form"));
+
+ // group_general
+ $group_general = $form->group("options_general")->label(t("Tag cloud options").$sep.t("General"));
+ $group_general->checkbox("load_defaults")
+ ->label(t("Reset all to default values"))
+ ->checked(false);
+ $group_general->checkbox("show_wholecloud_link")
+ ->label(t("Show 'View whole cloud' link in sidebar"))
+ ->checked(module::get_var("tag_cloud_html5", "show_wholecloud_link", null));
+ $group_general->checkbox("show_add_tag_form")
+ ->label(t("Show 'Add tag to album' form in sidebar (when permitted and applicable)"))
+ ->checked(module::get_var("tag_cloud_html5", "show_add_tag_form", null));
+ $group_general->input("height_sidebar")
+ ->label(t("Height of sidebar (as fraction of width)"))
+ ->value(round(module::get_var("tag_cloud_html5", "height_sidebar", null),3)) // round or else it gets 6 decimal places...
+ ->error_message("not_valid", t("Height of sidebar must be a 1-5 digit number"))
+ ->rules("required|valid_numeric|length[1,5]");
+ $group_general->checkbox("show_wholecloud_list")
+ ->label(t("Show tag list under cloud on 'View whole cloud' page"))
+ ->checked(module::get_var("tag_cloud_html5", "show_wholecloud_list", null));
+
+ foreach ($cfg['groups'] as $groupname => $grouptext) {
+ // maxtags - note that this is displayed under group_general!
+ $maxtags = module::get_var("tag_cloud_html5", "maxtags".$groupname, null);
+ $group_general->input("maxtags".$groupname)
+ ->label(t($grouptext).$sep.t("max tags shown"))
+ ->value($maxtags)
+ ->error_message("not_valid", t("Max tags must be a 1-4 digit number"))
+ ->rules("required|valid_numeric|length[1,4]");
+ // group_sidebar and group_wholecloud
+ $options = json_decode(module::get_var("tag_cloud_html5", "options".$groupname, null),true);
+ ${"group".$groupname} = $form->group("options".$groupname)->label(t("Tag cloud options").$sep.t($grouptext));
+ ${"group".$groupname}->input("maxSpeed".$groupname)
+ ->label(t($grouptext).$sep.t("max speed (typically 0.01-0.20)"))
+ ->value($options['maxSpeed'])
+ ->error_message("not_valid", t("Max speed must be a 1-5 digit number"))
+ ->rules("required|valid_numeric|length[1,5]");
+ ${"group".$groupname}->input("initialX".$groupname)
+ ->label(t($grouptext).$sep.t("initial horizontal speed (between +/-1.0, as fraction of max speed)"))
+ ->value($options['initial'][0])
+ ->error_message("not_valid", t("Initial horizontal speed must be a 1-4 digit number"))
+ ->rules("required|valid_numeric|length[1,4]");
+ ${"group".$groupname}->input("initialY".$groupname)
+ ->label(t($grouptext).$sep.t("initial vertical speed (between +/-1.0, as fraction of max speed)"))
+ ->value($options['initial'][1])
+ ->error_message("not_valid", t("Initial vertical speed must be a 1-4 digit number"))
+ ->rules("required|valid_numeric|length[1,4]");
+ ${"group".$groupname}->checkbox("initialDecel".$groupname)
+ ->label(t($grouptext).$sep.t("initial deceleration (if false, the initial speed is held until a mouseover event)"))
+ ->checked($options['initialDecel']);
+ ${"group".$groupname}->input("deadZone".$groupname)
+ ->label(t($grouptext).$sep.t("dead zone (0.0-1.0, where 0.0 is no dead zone and 1.0 is no active zone)"))
+ ->value($options['deadZone'])
+ ->error_message("not_valid", t("Dead zone must be a 1-4 digit number"))
+ ->rules("required|valid_numeric|length[1,4]");
+ ${"group".$groupname}->input("zoom".$groupname)
+ ->label(t($grouptext).$sep.t("zoom (<1.0 is zoom out, >1.0 is zoom in)"))
+ ->value($options['zoom'])
+ ->error_message("not_valid", t("Zoom must be a 1-4 digit number"))
+ ->rules("required|valid_numeric|length[1,4]");
+ ${"group".$groupname}->input("depth".$groupname)
+ ->label(t($grouptext).$sep.t("depth (0.0-1.0)"))
+ ->value($options['depth'])
+ ->error_message("not_valid", t("Depth must be a 1-4 digit number"))
+ ->rules("required|valid_numeric|length[1,4]");
+ ${"group".$groupname}->dropdown("outlineMethod".$groupname)
+ ->label(t($grouptext).$sep.t("outline method (mouseover event)"))
+ ->options(array("colour"=>t("change text color"),"outline"=>t("add outline around text"),"block"=>t("add block behind text")))
+ ->selected($options['outlineMethod']);
+ ${"group".$groupname}->input("outlineOffset".$groupname)
+ ->label(t($grouptext).$sep.t("outline offset (mouseover region size around text, in pixels)"))
+ ->value($options['outlineOffset'])
+ ->error_message("not_valid", t("Outline offset must be a 1-2 digit number"))
+ ->rules("required|valid_numeric|length[1,2]");
+ ${"group".$groupname}->input("outlineColour".$groupname)
+ ->label(t($grouptext).$sep.t("outline color (mouseover color, as #hhhhhh)"))
+ ->value($options['outlineColour'])
+ ->error_message("not_valid", t("Outline color must be specified as #hhhhhh"))
+ ->rules("required|length[7]");
+ ${"group".$groupname}->input("textColour".$groupname)
+ ->label(t($grouptext).$sep.t("text color (as #hhhhhh, or empty to use theme color)"))
+ ->value($options['textColour'])
+ ->error_message("not_valid", t("Text color must be specified as empty or #hhhhhh"))
+ ->rules("length[0,7]");
+ ${"group".$groupname}->input("textFont".$groupname)
+ ->label(t($grouptext).$sep.t("text font family (empty to use theme font)"))
+ ->value($options['textFont'])
+ ->error_message("not_valid", t("Text font must be empty or a 0-40 character string"))
+ ->rules("length[0,40]");
+ ${"group".$groupname}->input("textHeight".$groupname)
+ ->label(t($grouptext).$sep.t("text height (in pixels)"))
+ ->value($options['textHeight'])
+ ->error_message("not_valid", t("Text height must be a 1-2 digit number"))
+ ->rules("required|valid_numeric|length[1,2]");
+ ${"group".$groupname}->checkbox("frontSelect".$groupname)
+ ->label(t($grouptext).$sep.t("only allow tags in front to be selected"))
+ ->checked($options['frontSelect']);
+
+ }
+
+ $form->submit("")->value(t("Save"));
+
+ return $form;
+ }
+
+}
diff --git a/3.0/modules/tag_cloud_html5/controllers/tag_cloud.php b/3.0/modules/tag_cloud_html5/controllers/tag_cloud.php
new file mode 100644
index 00000000..ce9e0147
--- /dev/null
+++ b/3.0/modules/tag_cloud_html5/controllers/tag_cloud.php
@@ -0,0 +1,44 @@
+content = new View("tag_cloud_html5_page.html");
+ $template->content->title = t("Tag cloud");
+ $template->content->cloud = tag::cloud($maxtags);
+ $template->content->options = $options;
+
+ // Display the page.
+ print $template;
+ }
+}
diff --git a/3.0/modules/tag_cloud_html5/css/admin_tag_cloud_html5.css b/3.0/modules/tag_cloud_html5/css/admin_tag_cloud_html5.css
new file mode 100644
index 00000000..28afb51f
--- /dev/null
+++ b/3.0/modules/tag_cloud_html5/css/admin_tag_cloud_html5.css
@@ -0,0 +1,30 @@
+#g-content fieldset li {
+ display: block;
+ clear: both;
+ height: 24px;
+}
+#g-content fieldset input {
+ display: inline;
+ float: left;
+ height: 18px;
+ margin-right: 0.8em;
+ width: 250px;
+}
+#g-content fieldset select {
+ display: inline;
+ float: left;
+ height: 24px;
+ margin-right: 0.8em;
+ width: 256px;
+}
+#g-content fieldset label {
+ display: inline;
+ line-height: 24px;
+}
+#g-content fieldset label input.checkbox {
+ float: left;
+ height: 24px;
+ margin-right: 0.8em;
+ width: 20px;
+ margin-left: 236px;
+}
\ No newline at end of file
diff --git a/3.0/modules/tag_cloud_html5/css/tag_cloud_html5.css b/3.0/modules/tag_cloud_html5/css/tag_cloud_html5.css
new file mode 100644
index 00000000..bf20ce8c
--- /dev/null
+++ b/3.0/modules/tag_cloud_html5/css/tag_cloud_html5.css
@@ -0,0 +1,106 @@
+/* Tag cloud - sidebar ~~~~~~~~~~~~~~~~~~~~~~~ */
+
+/* comment out this first block to make the inline tags appear if the cloud doesn't load */
+#g-tag-cloud-html5-tags {
+ display: none;
+}
+
+#g-tag-cloud-html5-tags ul {
+ text-align: justify;
+}
+
+#g-tag-cloud-html5-tags ul li {
+ display: inline;
+ text-align: justify;
+}
+
+#g-tag-cloud-html5-tags ul li a {
+ text-decoration: none;
+}
+
+#g-tag-cloud-html5-tags ul li span {
+ display: none;
+}
+
+#g-tag-cloud-html5-page ul li a:hover {
+ text-decoration: underline;
+}
+
+/* Tag cloud - whole cloud page ~~~~~~~~~~~~~~~~~~~~~~~ */
+
+#g-tag-cloud-html5-page-canvas {
+ display: block;
+ margin: 0 auto;
+}
+
+#g-tag-cloud-html5-page-tags ul {
+ font-size: 1.2em;
+ text-align: justify;
+}
+
+#g-tag-cloud-html5-page-tags ul li {
+ display: inline;
+ line-height: 1.5em;
+ text-align: justify;
+}
+
+#g-tag-cloud-html5-page-tags ul li a {
+ text-decoration: none;
+}
+
+#g-tag-cloud-html5-page-tags ul li span {
+ display: none;
+}
+
+#g-tag-cloud-html5-page-tags ul li.size0 a {
+ color: #9cf;
+ font-size: 70%;
+ font-weight: 100;
+}
+
+#g-tag-cloud-html5-page-tags ul li.size1 a {
+ color: #9cf;
+ font-size: 80%;
+ font-weight: 100;
+}
+
+#g-tag-cloud-html5-page-tags ul li.size2 a {
+ color: #69f;
+ font-size: 90%;
+ font-weight: 300;
+}
+
+#g-tag-cloud-html5-page-tags ul li.size3 a {
+ color: #69c;
+ font-size: 100%;
+ font-weight: 500;
+}
+
+#g-tag-cloud-html5-page-tags ul li.size4 a {
+ color: #369;
+ font-size: 110%;
+ font-weight: 700;
+}
+
+#g-tag-cloud-html5-page-tags ul li.size5 a {
+ color: #0e2b52;
+ font-size: 120%;
+ font-weight: 900;
+}
+
+#g-tag-cloud-html5-page-tags ul li.size6 a {
+ color: #0e2b52;
+ font-size: 130%;
+ font-weight: 900;
+}
+
+#g-tag-cloud-html5-page-tags ul li.size7 a {
+ color: #0e2b52;
+ font-size: 140%;
+ font-weight: 900;
+}
+
+#g-tag-cloud-html5-page-tags ul li a:hover {
+ color: #f30;
+ text-decoration: underline;
+}
diff --git a/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_block.php b/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_block.php
new file mode 100644
index 00000000..e1df9264
--- /dev/null
+++ b/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_block.php
@@ -0,0 +1,65 @@
+ (t("Tag cloud")." HTML5"));
+ }
+
+ static function get($block_id, $theme) {
+ $block = "";
+ switch ($block_id) {
+ case "tag_cloud_html5_site":
+ // load settings
+ $options = module::get_var("tag_cloud_html5", "options_sidebar", null);
+ $maxtags = module::get_var("tag_cloud_html5", "maxtags_sidebar", null);
+ $showlink = module::get_var("tag_cloud_html5", "show_wholecloud_link", null);
+ $showaddtag = module::get_var("tag_cloud_html5", "show_add_tag_form", null);
+ $height = module::get_var("tag_cloud_html5", "height_sidebar", null);
+
+ // make the block
+ $block = new Block();
+ $block->css_id = "g-tag";
+ $block->title = t("Tag cloud");
+ $block->content = new View("tag_cloud_html5_block.html");
+ $block->content->cloud = tag::cloud($maxtags);
+ $block->content->options = $options;
+ $block->content->height = $height;
+
+ // add the 'View whole cloud' link if needed
+ if ($showlink) {
+ $block->content->wholecloud_link = "".t("View whole cloud")."";
+ } else {
+ $block->content->wholecloud_link = "";
+ }
+
+ // add the 'Add tag' form if needed
+ if ($theme->item() && $theme->page_subtype() != "tag" && access::can("edit", $theme->item()) && $showaddtag) {
+ $controller = new Tags_Controller();
+ $block->content->form = tag::get_add_form($theme->item());
+ } else {
+ $block->content->form = "";
+ }
+
+ break;
+ }
+ return $block;
+ }
+}
diff --git a/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_event.php b/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_event.php
new file mode 100644
index 00000000..4e7fc3ca
--- /dev/null
+++ b/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_event.php
@@ -0,0 +1,28 @@
+get("settings_menu")
+ ->append(Menu::factory("link")
+ ->id("tag_cloud_html5")
+ ->label(t("Tag cloud")." HTML5")
+ ->url(url::site("admin/tag_cloud_html5")));
+ }
+}
diff --git a/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_installer.php b/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_installer.php
new file mode 100644
index 00000000..422a6f2c
--- /dev/null
+++ b/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_installer.php
@@ -0,0 +1,78 @@
+ 0.05,
+ "deadZone" => 0.25,
+ "initial" => array(0.8,-0.3),
+ "initialDecel" => true,
+ "zoom" => 1.25,
+ "depth" => 0.5,
+ "outlineMethod" => "colour",
+ "outlineOffset" => 8,
+ "outlineColour" => "#eeeeee",
+ "textColour" => "",
+ "textFont" => "",
+ "textHeight" => 12,
+ "frontSelect" => true,
+ "wheelZoom" => false
+ )));
+ module::set_var("tag_cloud_html5", "options_wholecloud", json_encode(array(
+ "maxSpeed" => 0.05,
+ "deadZone" => 0.25,
+ "initial" => array(0.8,-0.3),
+ "initialDecel" => true,
+ "zoom" => 1.25,
+ "depth" => 0.5,
+ "outlineMethod" => "colour",
+ "outlineOffset" => 8,
+ "outlineColour" => "#eeeeee",
+ "textColour" => "",
+ "textFont" => "",
+ "textHeight" => 13,
+ "frontSelect" => true,
+ "wheelZoom" => false
+ )));
+ module::set_version("tag_cloud_html5", 4);
+ }
+
+ static function upgrade() {
+ if (is_null(module::get_var("tag_cloud_html5", "options_sidebar")) ||
+ is_null(module::get_var("tag_cloud_html5", "options_wholecloud")) ||
+ (module::get_version("tag_cloud_html5") < 4) ) {
+ module::install("tag_cloud_html5");
+ }
+ }
+
+ static function uninstall() {
+ module::clear_all_vars("tag_cloud_html5");
+ }
+
+}
diff --git a/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_theme.php b/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_theme.php
new file mode 100644
index 00000000..2bcb516a
--- /dev/null
+++ b/3.0/modules/tag_cloud_html5/helpers/tag_cloud_html5_theme.php
@@ -0,0 +1,25 @@
+script("jquery.tagcanvas.mod.min.js");
+ $theme->css("tag_cloud_html5.css");
+ }
+}
\ No newline at end of file
diff --git a/3.0/modules/tag_cloud_html5/js/excanvas.compiled.js b/3.0/modules/tag_cloud_html5/js/excanvas.compiled.js
new file mode 100644
index 00000000..a34ca1da
--- /dev/null
+++ b/3.0/modules/tag_cloud_html5/js/excanvas.compiled.js
@@ -0,0 +1,35 @@
+// Copyright 2006 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+document.createElement("canvas").getContext||(function(){var s=Math,j=s.round,F=s.sin,G=s.cos,V=s.abs,W=s.sqrt,k=10,v=k/2;function X(){return this.context_||(this.context_=new H(this))}var L=Array.prototype.slice;function Y(b,a){var c=L.call(arguments,2);return function(){return b.apply(a,c.concat(L.call(arguments)))}}var M={init:function(b){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var a=b||document;a.createElement("canvas");a.attachEvent("onreadystatechange",Y(this.init_,this,a))}},init_:function(b){b.namespaces.g_vml_||
+b.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");b.namespaces.g_o_||b.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");if(!b.styleSheets.ex_canvas_){var a=b.createStyleSheet();a.owningElement.id="ex_canvas_";a.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}g_o_\\:*{behavior:url(#default#VML)}"}var c=b.getElementsByTagName("canvas"),d=0;for(;d','","");this.element_.insertAdjacentHTML("BeforeEnd",t.join(""))};i.stroke=function(b){var a=[],c=P(b?this.fillStyle:this.strokeStyle),d=c.color,f=c.alpha*this.globalAlpha;a.push("g.x)g.x=e.x;if(h.y==null||e.yg.y)g.y=e.y}}a.push(' ">');if(b)if(typeof this.fillStyle=="object"){var m=this.fillStyle,r=0,n={x:0,y:0},o=0,q=1;if(m.type_=="gradient"){var t=m.x1_/this.arcScaleX_,E=m.y1_/this.arcScaleY_,p=this.getCoords_(m.x0_/this.arcScaleX_,m.y0_/this.arcScaleY_),
+z=this.getCoords_(t,E);r=Math.atan2(z.x-p.x,z.y-p.y)*180/Math.PI;if(r<0)r+=360;if(r<1.0E-6)r=0}else{var p=this.getCoords_(m.x0_,m.y0_),w=g.x-h.x,x=g.y-h.y;n={x:(p.x-h.x)/w,y:(p.y-h.y)/x};w/=this.arcScaleX_*k;x/=this.arcScaleY_*k;var R=s.max(w,x);o=2*m.r0_/R;q=2*m.r1_/R-o}var u=m.colors_;u.sort(function(ba,ca){return ba.offset-ca.offset});var J=u.length,da=u[0].color,ea=u[J-1].color,fa=u[0].alpha*this.globalAlpha,ga=u[J-1].alpha*this.globalAlpha,S=[],l=0;for(;l')}else a.push('');else{var K=this.lineScale_*this.lineWidth;if(K<1)f*=K;a.push("')}a.push("");this.element_.insertAdjacentHTML("beforeEnd",a.join(""))};i.fill=function(){this.stroke(true)};i.closePath=function(){this.currentPath_.push({type:"close"})};i.getCoords_=function(b,a){var c=this.m_;return{x:k*(b*c[0][0]+a*c[1][0]+c[2][0])-v,y:k*(b*c[0][1]+a*c[1][1]+c[2][1])-v}};i.save=function(){var b={};O(this,b);this.aStack_.push(b);this.mStack_.push(this.m_);this.m_=y(I(),this.m_)};i.restore=function(){O(this.aStack_.pop(),
+this);this.m_=this.mStack_.pop()};function ha(b){var a=0;for(;a<3;a++){var c=0;for(;c<2;c++)if(!isFinite(b[a][c])||isNaN(b[a][c]))return false}return true}function A(b,a,c){if(!!ha(a)){b.m_=a;if(c)b.lineScale_=W(V(a[0][0]*a[1][1]-a[0][1]*a[1][0]))}}i.translate=function(b,a){A(this,y([[1,0,0],[0,1,0],[b,a,1]],this.m_),false)};i.rotate=function(b){var a=G(b),c=F(b);A(this,y([[a,c,0],[-c,a,0],[0,0,1]],this.m_),false)};i.scale=function(b,a){this.arcScaleX_*=b;this.arcScaleY_*=a;A(this,y([[b,0,0],[0,a,
+0],[0,0,1]],this.m_),true)};i.transform=function(b,a,c,d,f,h){A(this,y([[b,a,0],[c,d,0],[f,h,1]],this.m_),true)};i.setTransform=function(b,a,c,d,f,h){A(this,[[b,a,0],[c,d,0],[f,h,1]],true)};i.clip=function(){};i.arcTo=function(){};i.createPattern=function(){return new U};function D(b){this.type_=b;this.r1_=this.y1_=this.x1_=this.r0_=this.y0_=this.x0_=0;this.colors_=[]}D.prototype.addColorStop=function(b,a){a=P(a);this.colors_.push({offset:b,color:a.color,alpha:a.alpha})};function U(){}G_vmlCanvasManager=
+M;CanvasRenderingContext2D=H;CanvasGradient=D;CanvasPattern=U})();
diff --git a/3.0/modules/tag_cloud_html5/js/jquery.tagcanvas.mod.min.js b/3.0/modules/tag_cloud_html5/js/jquery.tagcanvas.mod.min.js
new file mode 100644
index 00000000..44bf1876
--- /dev/null
+++ b/3.0/modules/tag_cloud_html5/js/jquery.tagcanvas.mod.min.js
@@ -0,0 +1,27 @@
+/**
+ * Copyright (C) 2010-2012 Graham Breach
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+/**
+ * jQuery.tagcanvas 1.17.1
+ * For more information, please contact
+ */
+/**
+ * Modified by Shad Laws 2012/06/01 -- all modified lines have "mod Shad Laws" comments
+ * - included initialDecel and deadZone as options
+ * - set defaults of new options to mimic behavior without them (false and 0)
+ * - removed two unnecessary variable declarations caught by YUI Compressor
+ */
+(function(I){var R,Q,G=Math.abs,r=Math.sin,h=Math.cos,z=Math.max,V=Math.min,B={},C={},D={0:"0,",1:"17,",2:"34,",3:"51,",4:"68,",5:"85,",6:"102,",7:"119,",8:"136,",9:"153,",a:"170,",A:"170,",b:"187,",B:"187,",c:"204,",C:"204,",d:"221,",D:"221,",e:"238,",E:"238,",f:"255,",F:"255,"},e,J,d,l=document,y,c={};for(R=0;R<256;++R){Q=R.toString(16);if(R<16){Q="0"+Q}C[Q]=C[Q.toUpperCase()]=R.toString()+","}function N(i){return typeof(i)!="undefined"}function H(j){var Y=j.length-1,X,Z;while(Y){Z=~~(Math.random()*Y);X=j[Y];j[Y]=j[Z];j[Z]=X;--Y}}function n(Y,aa,af,ac){var ab,ae,j,ad,ag=[],Z=Math.PI*(3-Math.sqrt(5)),X=2/Y;for(ab=0;ab0)}function W(ae,j){var X=1024,aa=ae.weightGradient,Z,ac,Y,ad,ab;if(ae.gCanvas){ac=ae.gCanvas.getContext("2d")}else{ae.gCanvas=Z=g(X,1);if(!Z){return null}ac=Z.getContext("2d");ad=ac.createLinearGradient(0,0,X,0);for(Y in aa){ad.addColorStop(1-Y,aa[Y])}ac.fillStyle=ad;ac.fillRect(0,0,X,1)}ab=ac.getImageData(~~((X-1)*j),0,1,1).data;return"rgba("+ab[0]+","+ab[1]+","+ab[2]+","+(ab[3]/255)+")"}function u(aa,Z,X,ad,ab,ac,j){var Y=(ac||0)+(j&&j[0]<0?G(j[0]):0),i=(ac||0)+(j&&j[1]<0?G(j[1]):0);aa.font=Z;aa.textBaseline="top";aa.fillStyle=X;ab&&(aa.shadowColor=ab);ac&&(aa.shadowBlur=ac);j&&(aa.shadowOffsetX=j[0],aa.shadowOffsetY=j[1]);aa.fillText(ad,Y,i)}function m(aj,ab,af,ah,aa,X,ad,ae,j,ai,ag){var Y=ah+G(j[0])+ae+ae,i=aa+G(j[1])+ae+ae,Z,ac;Z=g(Y+ai,i+ag);if(!Z){return null}ac=Z.getContext("2d");u(ac,ab,X,aj,ad,ae,j);return Z}function P(ab,ae,af,Y){var Z=ab.width+G(Y[0])+af+af,j=ab.height+G(Y[1])+af+af,ac,ad,aa=(af||0)+(Y&&Y[0]<0?G(Y[0]):0),X=(af||0)+(Y&&Y[1]<0?G(Y[1]):0);ac=g(Z,j);if(!ac){return null}ad=ac.getContext("2d");ae&&(ad.shadowColor=ae);af&&(ad.shadowBlur=af);Y&&(ad.shadowOffsetX=Y[0],ad.shadowOffsetY=Y[1]);ad.drawImage(ab,aa,X);return ac}function K(aj,ab,ah){var ai=parseInt(aj.length*ah),aa=parseInt(ah*2),Y=g(ai,aa),ae,j,Z,ad,ag,af,X,ac;if(!Y){return null}ae=Y.getContext("2d");ae.fillStyle="#000";ae.fillRect(0,0,ai,aa);u(ae,ah+"px "+ab,"#fff",aj);j=ae.getImageData(0,0,ai,aa);Z=j.width;ad=j.height;ac={min:{x:Z,y:ad},max:{x:-1,y:-1}};for(af=0;af0){if(agac.max.x){ac.max.x=ag}if(afac.max.y){ac.max.y=af}}}}if(Z!=ai){ac.min.x*=(ai/Z);ac.max.x*=(ai/Z)}if(ad!=aa){ac.min.y*=(ai/ad);ac.max.y*=(ai/ad)}Y=null;return ac}function t(i){return"'"+i.replace(/(\'|\")/g,"").replace(/\s*,\s*/g,"', '")+"'"}function A(i,j,X){X=X||l;if(X.addEventListener){X.addEventListener(i,j,false)}else{X.attachEvent("on"+i,j)}}function O(Z,ab,Y,j){var X=j.taglist,aa=j.imageScale;if(aa&&!(ab.width&&ab.height)){A("load",function(){O(Z,ab,Y,j)},window);return}if(!Z.complete){A("load",function(){O(Z,ab,Y,j)},Z);return}ab.width=ab.width;ab.height=ab.height;if(aa){Z.width=ab.width*aa;Z.height=ab.height*aa}Y.w=Z.width;Y.h=Z.height;X.push(Y)}function M(Y,X){var j=l.defaultView,i=X.replace(/\-([a-z])/g,function(Z){return Z.charAt(1).toUpperCase()});return(j&&j.getComputedStyle&&j.getComputedStyle(Y,null).getPropertyValue(X))||(Y.currentStyle&&Y.currentStyle[i])}function x(X,j){var i=1,Y;if(X.weightFrom){i=1*(j.getAttribute(X.weightFrom)||X.textHeight)}else{if(Y=M(j,"font-size")){i=(Y.indexOf("px")>-1&&Y.replace("px","")*1)||(Y.indexOf("pt")>-1&&Y.replace("pt","")*1.25)||Y*3.3}else{X.weight=false}}return i}function k(X){L(X);var j=X.target||X.fromElement.parentNode,i=s.tc[j.id];i&&(i.mx=i.my=-1)}function L(Z){var Y,X,j=l.documentElement,aa;for(Y in s.tc){X=s.tc[Y];if(X.tttimer){clearTimeout(X.tttimer);X.tttimer=null}aa=I(X.canvas).offset();if(Z.pageX){X.mx=Z.pageX-aa.left;X.my=Z.pageY-aa.top}else{X.mx=Z.clientX+(j.scrollLeft||l.body.scrollLeft)-aa.left;X.my=Z.clientY+(j.scrollTop||l.body.scrollTop)-aa.top}}}function q(Y){var j=s,i=l.addEventListener?0:1,X=Y.target&&N(Y.target.id)?Y.target.id:Y.srcElement.parentNode.id;if(X&&Y.button==i&&j.tc[X]){L(Y);j.tc[X].Clicked(Y)}}function T(X){var i=s,j=X.target&&N(X.target.id)?X.target.id:X.srcElement.parentNode.id;if(j&&i.tc[j]){X.cancelBubble=true;X.returnValue=false;X.preventDefault&&X.preventDefault();i.tc[j].Wheel((X.wheelDelta||X.detail)>0)}}function o(){var X=s.tc,j;for(j in X){X[j].Draw()}}function b(X,i){var j=r(i),Y=h(i);return{x:X.x,y:(X.y*Y)+(X.z*j),z:(X.y*-j)+(X.z*Y)}}function a(X,i){var j=r(i),Y=h(i);return{x:(X.x*Y)+(X.z*-j),y:X.y,z:(X.x*j)+(X.z*Y)}}function S(X,ae,ad,Z,ac,aa){var i,Y,ab,j=X.z1/(X.z1+X.z2+ae.z);i=ae.y*j*aa;Y=ae.x*j*ac;ab=X.z2+ae.z;return{x:Y,y:i,z:ab}}function f(i){this.ts=new Date().valueOf();this.tc=i;this.x=this.y=this.w=this.h=this.sc=1;this.z=0;this.Draw=i.pulsateTo<1&&i.outlineMethod!="colour"?this.DrawPulsate:this.DrawSimple;this.SetMethod(i.outlineMethod)}e=f.prototype;e.SetMethod=function(X){var j={block:["PreDraw","DrawBlock"],colour:["PreDraw","DrawColour"],outline:["PostDraw","DrawOutline"],classic:["LastDraw","DrawOutline"],none:["LastDraw"]},i=j[X]||j.outline;if(X=="none"){this.Draw=function(){return 1}}else{this.drawFunc=this[i[1]]}this[i[0]]=this.Draw};e.Update=function(ad,ac,ae,aa,ab,j,Z,i){var X=this.tc.outlineOffset,Y=2*X;this.x=ab*ad+Z-X;this.y=ab*ac+i-X;this.w=ab*ae+Y;this.h=ab*aa+Y;this.sc=ab;this.z=j.z};e.DrawOutline=function(aa,i,Z,j,X,Y){aa.strokeStyle=Y;aa.strokeRect(i,Z,j,X)};e.DrawColour=function(Y,ab,Z,ac,X,i,ad,j,aa){return this[ad.image?"DrawColourImage":"DrawColourText"](Y,ab,Z,ac,X,i,ad,j,aa)};e.DrawColourText=function(Z,ac,aa,ad,X,i,ae,j,ab){var Y=ae.colour;ae.colour=i;ae.Draw(Z,j,ab);ae.colour=Y;return 1};e.DrawColourImage=function(ac,af,ad,ag,ab,i,aj,j,ae){var ah=ac.canvas,Z=~~z(af,0),Y=~~z(ad,0),aa=V(ah.width-Z,ag)+0.5|0,ai=V(ah.height-Y,ab)+0.5|0,X;if(y){y.width=aa,y.height=ai}else{y=g(aa,ai)}if(!y){return this.SetMethod("outline")}X=y.getContext("2d");X.drawImage(ah,Z,Y,aa,ai,0,0,aa,ai);ac.clearRect(Z,Y,aa,ai);aj.Draw(ac,j,ae);ac.setTransform(1,0,0,1,0,0);ac.save();ac.beginPath();ac.rect(Z,Y,aa,ai);ac.clip();ac.globalCompositeOperation="source-in";ac.fillStyle=i;ac.fillRect(Z,Y,aa,ai);ac.restore();ac.globalCompositeOperation="destination-over";ac.drawImage(y,0,0,aa,ai,Z,Y,aa,ai);ac.globalCompositeOperation="source-over";return 1};e.DrawBlock=function(aa,i,Z,j,X,Y){aa.fillStyle=Y;aa.fillRect(i,Z,j,X)};e.DrawSimple=function(Z,i,j,Y){var X=this.tc;Z.setTransform(1,0,0,1,0,0);Z.strokeStyle=X.outlineColour;Z.lineWidth=X.outlineThickness;Z.shadowBlur=Z.shadowOffsetX=Z.shadowOffsetY=0;Z.globalAlpha=1;return this.drawFunc(Z,this.x,this.y,this.w,this.h,X.outlineColour,i,j,Y)};e.DrawPulsate=function(aa,i,j,Y){var Z=new Date().valueOf()-this.ts,X=this.tc;aa.setTransform(1,0,0,1,0,0);aa.strokeStyle=X.outlineColour;aa.lineWidth=X.outlineThickness;aa.shadowBlur=aa.shadowOffsetX=aa.shadowOffsetY=0;aa.globalAlpha=X.pulsateTo+((1-X.pulsateTo)*(0.5+(h(2*Math.PI*Z/(1000*X.pulsateTime))/2)));return this.drawFunc(aa,this.x,this.y,this.w,this.h,X.outlineColour,i,j,Y)};e.Active=function(X,i,j){return(i>=this.x&&j>=this.y&&i<=this.x+this.w&&j<=this.y+this.h)};e.PreDraw=e.PostDraw=e.LastDraw=function(){};function E(Z,j,ad,af,ae,ab,X,Y){var ac=Z.ctxt,aa;this.tc=Z;this.image=j.src?j:null;this.name=j.src?"":j;this.title=ad.title||null;this.a=ad;this.p3d={x:af[0]*Z.radius*1.1,y:af[1]*Z.radius*1.1,z:af[2]*Z.radius*1.1};this.x=this.y=0;this.w=ae;this.h=ab;this.colour=X||Z.textColour;this.textFont=Y||Z.textFont;this.weight=this.sc=this.alpha=1;this.weighted=!Z.weight;this.outline=new f(Z);if(this.image){if(Z.txtOpt&&Z.shadow){aa=P(this.image,Z.shadow,Z.shadowBlur,Z.shadowOffset);if(aa){this.image=aa;this.w=aa.width;this.h=aa.height}}}else{this.textHeight=Z.textHeight;this.extents=K(this.name,this.textFont,this.textHeight);this.Measure(ac,Z)}this.SetShadowColour=Z.shadowAlpha?this.SetShadowColourAlpha:this.SetShadowColourFixed;this.SetDraw(Z)}J=E.prototype;J.SetDraw=function(i){this.Draw=this.image?(i.ie>7?this.DrawImageIE:this.DrawImage):this.DrawText;i.noSelect&&(this.CheckActive=function(){})};J.Measure=function(ab,j){this.h=this.extents?this.extents.max.y+this.extents.min.y:this.textHeight;ab.font=this.font=this.textHeight+"px "+this.textFont;this.w=ab.measureText(this.name).width;if(j.txtOpt){var Y=j.txtScale,Z=Y*this.textHeight,aa=Z+"px "+this.textFont,X=[Y*j.shadowOffset[0],Y*j.shadowOffset[1]],i;ab.font=aa;i=ab.measureText(this.name).width;this.image=m(this.name,aa,Z,i,Y*this.h,this.colour,j.shadow,Y*j.shadowBlur,X,Y,Y);if(this.image){this.w=this.image.width/Y;this.h=this.image.height/Y}this.SetDraw(j);j.txtOpt=this.image}};J.SetWeight=function(i){if(!this.name.length){return}this.weight=i;this.Weight(this.tc.ctxt,this.tc);this.Measure(this.tc.ctxt,this.tc)};J.Weight=function(Y,X){var j=this.weight,i=X.weightMode;this.weighted=true;if(i=="colour"||i=="both"){this.colour=W(X,(j-X.min_weight)/(X.max_weight-X.min_weight))}if(i=="size"||i=="both"){this.textHeight=j*X.weightSize}this.extents=K(this.name,this.textFont,this.textHeight)};J.SetShadowColourFixed=function(X,j,i){X.shadowColor=j};J.SetShadowColourAlpha=function(X,j,i){X.shadowColor=p(j,i)};J.DrawText=function(X,ab,j){var ac=this.tc,Z=this.x,Y=this.y,aa,i,ad=this.sc;X.globalAlpha=this.alpha;X.setTransform(ad,0,0,ad,0,0);X.fillStyle=this.colour;ac.shadow&&this.SetShadowColour(X,ac.shadow,this.alpha);X.font=this.font;aa=this.w;i=this.h;Z+=(ab/ad)-(aa/2);Y+=(j/ad)-(i/2);X.fillText(this.name,Z,Y)};J.DrawImage=function(Z,af,Y){var ac=this.x,aa=this.y,ag=this.sc,j=this.image,ad=this.w,X=this.h,ab=this.alpha,ae=this.shadow;Z.globalAlpha=ab;Z.setTransform(ag,0,0,ag,0,0);Z.fillStyle=this.colour;ae&&this.SetShadowColour(Z,ae,ab);ac+=(af/ag)-(ad/2);aa+=(Y/ag)-(X/2);Z.drawImage(j,ac,aa,ad,X)};J.DrawImageIE=function(Z,ad,Y){var j=this.image,ae=this.sc,ac=j.width=this.w*ae,X=j.height=this.h*ae,ab=(this.x*ae)+ad-(ac/2),aa=(this.y*ae)+Y-(X/2);Z.setTransform(1,0,0,1,0,0);Z.globalAlpha=this.alpha;Z.drawImage(j,ab,aa)};J.Calc=function(Z,Y){var i=a(this.p3d,Z),j=this.tc,aa=j.minBrightness,X=j.radius;this.p3d=b(i,Y);i=S(j,this.p3d,this.w,this.h,j.stretchX,j.stretchY);this.x=i.x;this.y=i.y;this.sc=(j.z1+j.z2-i.z)/j.z2;this.alpha=z(aa,V(1,aa+1-((i.z-j.z2+X)/(2*X))))};J.CheckActive=function(Y,ac,X){var ad=this.tc,i=this.outline,ab=this.w,j=this.h,aa=this.x-ab/2,Z=this.y-j/2;i.Update(aa,Z,ab,j,this.sc,this.p3d,ac,X);return i.Active(Y,ad.mx,ad.my)?i:null};J.Clicked=function(aa){var j=this.a,X=j.target,Y=j.href,i;if(X!=""&&X!="_self"){if(self.frames[X]){self.frames[X]=Y}else{try{if(top.frames[X]){top.frames[X]=Y;return}}catch(Z){}window.open(Y,X)}return}if(l.createEvent){i=l.createEvent("MouseEvents");i.initMouseEvent("click",1,1,window,0,0,0,0,0,0,0,0,0,0,null);if(!j.dispatchEvent(i)){return}}else{if(j.fireEvent){if(!j.fireEvent("onclick")){return}}}l.location=Y};function s(){var j,X={mx:-1,my:-1,z1:20000,z2:20000,z0:0.0002,freezeActive:false,activeCursor:"pointer",pulsateTo:1,pulsateTime:3,reverse:false,depth:0.5,maxSpeed:0.05,minSpeed:0,decel:0.95,interval:20,initial:null,initialDecel:false,deadZone:0,hideTags:true,minBrightness:0.1,outlineColour:"#ffff99",outlineThickness:2,outlineOffset:5,outlineMethod:"outline",textColour:"#ff99ff",textHeight:15,textFont:"Helvetica, Arial, sans-serif",shadow:"#000",shadowBlur:0,shadowOffset:[0,0],zoom:1,weight:false,weightMode:"size",weightFrom:null,weightSize:1,weightGradient:{0:"#f00",0.33:"#ff0",0.66:"#0f0",1:"#00f"},txtOpt:true,txtScale:2,frontSelect:false,wheelZoom:true,zoomMin:0.3,zoomMax:3,zoomStep:0.05,shape:"sphere",lock:null,tooltip:null,tooltipDelay:300,tooltipClass:"tctooltip",radiusX:1,radiusY:1,radiusZ:1,stretchX:1,stretchY:1,shuffleTags:false,noSelect:false,noMouse:false,imageScale:1};for(j in X){this[j]=X[j]}this.max_weight=0;this.min_weight=200}d=s.prototype;d.Draw=function(){var ag=this.canvas,ae=ag.width,X=ag.height,j=0,ad=this.yaw,Y=this.pitch,Z=ae/2,aj=X/2,ah=this.ctxt,ab,ai,af,ac=-1,al=this.taglist,aa=al.length,ak=this.frontSelect;if(ad==0&&Y==0&&this.drawn&&!this.deadZoneActive){return this.Animate(ae,X)}ah.setTransform(1,0,0,1,0,0);this.active=null;for(af=0;af=0&&this.my>=0&&al[af].CheckActive(ah,Z,aj);if(ai&&ai.sc>j&&(!ak||ai.z<=0)){ab=ai;ab.index=ac=af;j=ai.sc}}this.active=ab;if(!this.txtOpt&&this.shadow){ah.shadowBlur=this.shadowBlur;ah.shadowOffsetX=this.shadowOffset[0];ah.shadowOffsetY=this.shadowOffset[1]}ah.clearRect(0,0,ae,X);for(af=0;af=0&&aa>=0&&abae){this.yaw=ad>X.z0?X.yaw*X.decel:0}if(j!="y"&&Y>ae){this.pitch=Y>X.z0?X.pitch*X.decel:0}}}};d.Zoom=function(i){this.z2=this.z1*(1/i);this.drawn=0};d.Clicked=function(Y){var X=this.taglist,i=this.active;try{if(i&&X[i.index]){X[i.index].Clicked(Y)}}catch(j){}};d.Wheel=function(j){var X=this.zoom+this.zoomStep*(j?1:-1);this.zoom=V(this.zoomMax,z(this.zoomMin,X));this.Zoom(this.zoom)};s.tc={};jQuery.fn.tagcanvas=function(X,j){var i,Y=j?jQuery("#"+j):this;if(l.all&&!j){return false}i=Y.find("a");if(N(window.G_vmlCanvasManager)){this.each(function(){I(this)[0]=window.G_vmlCanvasManager.initElement(I(this)[0])});X.ie=parseFloat(navigator.appVersion.split("MSIE")[1])}if(!i.length||!this[0].getContext||!this[0].getContext("2d").fillText){return false}this.each(function(){var ab,Z,ad,ag,ah,ac,af,ae=[],aa={sphere:n,vcylinder:w,hcylinder:F};j||(i=I(this).find("a"));ac=new s;for(ab in X){ac[ab]=X[ab]}ac.z1=(19800/(Math.exp(ac.depth)*(1-1/Math.E)))+20000-19800/(1-(1/Math.E));ac.z2=ac.z1*(1/ac.zoom);ac.radius=(this.height>this.width?this.width:this.height)*0.33*(ac.z2+ac.z1)/(ac.z1);ac.yaw=ac.initial?ac.initial[0]*ac.maxSpeed:0;ac.pitch=ac.initial?ac.initial[1]*ac.maxSpeed:0;ac.canvas=I(this)[0];ac.ctxt=ac.canvas.getContext("2d");ac.textFont=ac.textFont&&t(ac.textFont);ac.deadZone*=1;ac.pulsateTo*=1;ac.textHeight*=1;ac.minBrightness*=1;ac.ctxt.textBaseline="top";if(ac.shadowBlur||ac.shadowOffset[0]||ac.shadowOffset[1]){ac.ctxt.shadowColor=ac.shadow;ac.shadow=ac.ctxt.shadowColor;ac.shadowAlpha=v()}else{delete ac.shadow}ac.taglist=[];ac.shape=aa[ac.shape]||aa.sphere;Z=ac.shape(i.length,ac.radiusX,ac.radiusY,ac.radiusZ);ac.shuffleTags&&H(Z);ac.listLength=i.length;for(ab=0;abac.max_weight){ac.max_weight=af}if(afac.min_weight)){for(ab=0;ab
+
+
+
+ = t("Tag cloud HTML5 settings") ?>
+
+
+ = t("This module uses TagCanvas, a non-flash, HTML5-compliant jQuery plugin. It also uses excanvas to maintain compatibility with pre-9.0 Internet Explorer.") ?>
+
+
+ = t("More details on the options below are given at TagCanvas's homepage here.") ?>
+