Class FormatSelection

Description

selects the format in which the MathML will be displayed

There are 3 mechanisms by which we determine how the MathML will be sent to the user agent. The first thing we check is to see if the user has explicitly asked for a certain format. The user can ask for a certain format on a per-request basis, or on a persistent basis. If a user specifies a preferred format on both a per-request basis, and a persistent basis, the per-request preference takes precedence. If the user has not explicitly requested a MathML format, we make a guess as to their preferred format based on their user agent string.

The user can specify a preferred format through setting the appropriate GET variable. This name of this variable is determined by the $format_GET_var member of this class. The user can specificy a persistent preference through the GET variables also. The name of this variable is determined by the $set_format_GET_var. Once the user has specified a persistent preference, this script will set a cookie (or a session variable as a fallback), to save that user's preference.

If the user has not specified a preference, we will analyze their user agent string to guess the appropriate format. Currently, we give plain XHTML+MathML to Firefox users, MathPlayer-compatible XHTML+MathML to anyone with MathPlayer, and HTML+Images to everyone else.

Located in /format_selection.php (line 53)


	
			
Variable Summary
string $cur_format
array $formats
string $format_var
mixed $validators
Method Summary
FormatSelection FormatSelection ()
void BrowserDefault ([ $ua_str = false])
mixed GetForce ()
string GetFormat ()
string Header (string $format)
void SetPersistent ()
Variables
string $cur_format = 'HTML+Images' (line 91)

the current MathML format being served to the user agent

array $formats = array(
'XHTML+MathML',
'MathPlayer',
'HTML+Images'
)
(line 59)

the available MathML formats

string $format_var = 'MathFormat' (line 97)

the GET variable that specifies the MathML format for the current request

mixed $set_format_var = 'SetMathFormat' (line 101)

the GET variable that specifies a new persistent MathML format

mixed $validators = array(
'Jigsaw CSS Validator',
'ValideXHTML',
'W3C Validator',
'W3C Line Mode',
)
(line 103)
Methods
Constructor FormatSelection (line 244)

sets any persistent preferences and determines the right MathML Format

FormatSelection FormatSelection ()
BrowserDefault (line 110)
void BrowserDefault ([ $ua_str = false])
  • $ua_str
GetForce (line 212)

determines the user's explicit preferred MathML format

If the user has specified a preferred MathML format, this will return the string for that format. Otherwise, it will return NULL.

mixed GetForce ()
GetFormat (line 156)

determines which MathML format to send to the user agent

This determines which MathML format to send to the user agent. First, it checks to see if the user has specified a preferred format, as determined by the FormatSelection->GetForce() function. If so, it will return that preference. Otherwise, it will base it's choice on an analysis of the user agent string.

When making a choice based on the user agent string, it will give the plain XHTML+MathML document to Firefox and to any crawlers. If the user agent string mentions MathPlayer, then it will determine that we should send MathPlayer-compatible MathML. Otherwise, it will choose HTML+Images.

  • return: the MathML format to be used
string GetFormat ()
Header (line 82)

returns the header string appropriate for the given page format

string Header (string $format)
  • string $format
SetPersistent (line 188)

sets a persistent selection

If the user has specified a persistent preference for their MathML format, this will save that through a cookie or session variable. The names of both the cookie and the sesision variable are $this->format_var. The session variable is meant to be a fallback for those without cookies.

void SetPersistent ()

Documentation generated on Fri, 21 Jul 2006 10:44:31 -0500 by phpDocumentor 1.3.0RC6