Luminous  git-master
 All Classes Files Functions Variables
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
LuminousOptions Class Reference

Options class. More...

Public Member Functions

 __get ($name)
 __set ($name, $value)
 LuminousOptions ($opts=null)
 set ($nameOrArray, $value=null)

Private Member Functions

 set_bool ($key, $value)
 set_format ($value)
 set_height ($value)
 set_start_line ($value)
 set_string ($key, $value, $nullable=false)
 set_theme ($value)

Static Private Member Functions

static check_type ($value, $type, $nullable=false)

Private Attributes

 $auto_link = true
 Hyperlinking.
 $cache = true
 Whether to use the built-in cache.
 $cache_age = 7776000
 Maximum age of cache files in seconds.
 $failure_tag = 'pre'
 Failure recovery.
 $format = 'html'
 Output format.
 $highlight_lines = array()
 Highlighting of lines.
 $html_strict = false
 HTML strict standards mode.
 $include_javascript = false
 JavaScript extras.
 $include_jquery = false
 jQuery
 $line_numbers = true
 Line numbering.
 $max_height = -1
 Widget height constraint.
 $relative_root = null
 Location of Luminous relative to your document root.
 $sql_function = null
 Defines an SQL function which can execute queries on a database.
 $start_line = 1
 Line number of first line.
 $theme = 'luminous_light.css'
 Theme.
 $verbose = true
 $wrap_width = -1
 Word wrapping.

Detailed Description

Options class.

Warning
This object's structure isn't guaranteed to be stable so don't read or write these directly. As a user, you should be using luminous::set() and luminous::setting()

We use a fair bit of PHP trickery in the implementation here. The keener among you will notice that the options are all private: don't worry about that. We override the __set() method to apply option specific validation. Options can be written to as normal.

The option variable names correspond with option strings that can be passed through luminous::set(), however, for historical reasons, underscores can be replaced with dashed in the call.

Member Data Documentation

LuminousOptions::$auto_link = true
private

Hyperlinking.

If the formatter supports hyper-linking, this setting controls whether or not URLs will be automatically linked

LuminousOptions::$cache_age = 7776000
private

Maximum age of cache files in seconds.

Cache files which have not been read for this length of time will be removed from the file system. The file's 'mtime' is used to calculate when it was last used, and a cache hit triggers a 'touch'

Set to -1 or 0 to disable cache purges

LuminousOptions::$failure_tag = 'pre'
private

Failure recovery.

If Luminous hits some kind of unrecoverable internal error, it should return the input source code back to you. If you want, it can be wrapped in an HTML tag. Hopefully you will never see this.

LuminousOptions::$format = 'html'
private

Output format.

Chooses which output format to use. Current valid settings are:

  • 'html' - standard HTML element, contained in a <div> with class 'luminous', CSS is not included and must be included on the page separately (probably with luminous::head_html())
  • 'html-full' - A complete HTML document. CSS is included.
  • 'html-inline' - Very similar to 'html' but geared towards inline display. Probably not very useful.
  • 'latex' - A full LaTeX document
  • 'none' or NULL - No formatter. Internal XML format is returned. You probably don't want this.
LuminousOptions::$highlight_lines = array()
private

Highlighting of lines.

If the formatter supports highlighting lines, this setting allows the caller to specify the set of line numbers to highlight

LuminousOptions::$html_strict = false
private

HTML strict standards mode.

The HTML4-strict doctype disallows a few things which are technically useful. Set this to true if you don't want Luminous to break validation on your HTML4-strict document. Luminous should be valid HTML4 loose/transitional and HTML5 without needing to enable this.

LuminousOptions::$include_javascript = false
private

JavaScript extras.

controls whether luminous::head_html() outputs the javascript 'extras'.

LuminousOptions::$include_jquery = false
private

jQuery

Controls whether luminous::head_html() outputs jQuery, which is required for the JavaScript extras. This has no effect if $include_javascript is false.

LuminousOptions::$line_numbers = true
private

Line numbering.

If the formatter supports line numbering, this setting controls whether or not lines should be numbered

LuminousOptions::$max_height = -1
private

Widget height constraint.

If the formatter supports heigh constraint, this setting controls whether or not to constrain the widget's height, and to what.

LuminousOptions::$relative_root = null
private

Location of Luminous relative to your document root.

If you use luminous::head_html(), it has to try to figure out the path to the style/ directory so that it can return a correct URL to the necessary stylesheets. Luminous may get this wrong in some situations, specifically it is currently impossible to get this right if Luminous exists on the filesystem outside of the document root, and you have used a symbolic link to put it inside. For this reason, this setting allows you to override the path.

e.g. If you set this to '/extern/highlighter', the stylesheets will be linked with <link rel='stylesheet' href='/extern/highlighter/style/luminous.css'>

LuminousOptions::$sql_function = null
private

Defines an SQL function which can execute queries on a database.

An SQL database can be used as a replacement for the file-system cache database. This function should act similarly to the mysql_query function: it should take a single argument (the query string) and return:

  • boolean false if the query fails
  • boolean true if the query succeeds but has no return value
  • An array of associative arrays if the query returns rows (each element is a row, and each row is an map keyed by field name)
LuminousOptions::$start_line = 1
private

Line number of first line.

If the formatter supports line numbering, this setting controls number of the first line

LuminousOptions::$theme = 'luminous_light.css'
private

Theme.

The default theme to use. This is observed by the HTML-full and LaTeX formatters, it is also read by luminous::head_html().

This should be a valid theme which exists in style/

LuminousOptions::$wrap_width = -1
private

Word wrapping.

If the formatter supports line wrapping, lines will be wrapped at this number of characters (0 or -1 to disable)


The documentation for this class was generated from the following file: