Textpattern PHP Cross Reference Content Management Systems

Summary: /textpattern/lib/txplib_html.php - 1923 lines - 52662 bytes - Source - Print

Description: Collection of HTML widgets.

Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 61 functions

end_page()
column_head()
column_multi_head()
hCell()
sLink()
eLink()
wLink()
dLink()
aLink()
prevnext_link()
PrevNextLink()
nav_form()
wrapRegion()
wrapGroup()
startSkelTable()
startTable()
endTable()
stackRows()
td()
tda()
tdtl()
tr()
tdcs()
tdrs()
fLabelCell()
fInputCell()
inputLabel()
tag()
tag_void()
tag_start()
tag_end()
graf()
hed()
href()
strong()
span()
htmlPre()
comment()
small()
assRow()
assHead()
popHelp()
fieldHelp()
popHelpSubtle()
popTag()
popTagLinks()
messenger()
multi_edit()
pageby_form()
upload_form()
search_form()
pref_text()
dom_attach()
script_js()
toggle_box()
cookie_box()
fieldset()
asyncHref()
doWrap()
doTag()
doLabel()

Functions

Functions that are not part of a class:

end_page()  line: 70
Renders the admin-side footer.

The footer's default markup is provided by a theme. It can be further
customised via the "admin_side > footer" pluggable UI callback event.

In addition to the pluggable UI, this function also calls callback events
"admin_side > main_content_end" and "admin_side > body_end".
column_head($value, $sort = '', $event = '', $is_link = '', $dir = '', $crit = '', $method = '', $class = '', $step = 'list')  line: 108
Renders the user interface for one head cell of columnar data.

return: string HTML
param: string $value   Element text
param: string $sort    Sort criterion
param: string $event   Event name
param: bool   $is_link Include link to admin action in user interface according to the other params
param: string $dir     Sort direction, either "asc" or "desc"
param: string $crit    Search criterion
param: string $method  Search method
param: string $class   HTML "class" attribute applied to the resulting element
param: string $step    Step name
column_multi_head($head_items, $class = '')  line: 137
Renders the user interface for multiple head cells of columnar data.

return: string HTML
param: array  $head_items An array of hashed elements. Valid keys: 'value', 'sort', 'event', 'is_link', 'dir', 'crit', 'method'
param: string $class      HTML "class" attribute applied to the resulting element
hCell($text = '', $caption = '', $atts = '')  line: 189
Renders a <th> element.

return: string HTML
param: string       $text    Cell text
param: string       $caption Is not used
param: string|array $atts    HTML attributes
sLink($event, $step, $linktext, $class = '')  line: 205
Renders a link invoking an admin-side action.

return: string HTML
param: string $event    Event
param: string $step     Step
param: string $linktext Link text
param: string $class    HTML class attribute for link
eLink($event, $step, $thing, $value, $linktext, $thing2 = '', $val2 = '', $title = '', $class = '')  line: 227
Renders a link with two additional URL parameters.

Renders a link invoking an admin-side action while taking up to two
additional URL parameters.

return: string HTML
param: string $event    Event
param: string $step     Step
param: string $thing    URL parameter key #1
param: string $value    URL parameter value #1
param: string $linktext Link text
param: string $thing2   URL parameter key #2
param: string $val2     URL parameter value #2
param: string $title    Anchor title
param: string $class    HTML class attribute
wLink($event, $step = '', $thing = '', $value = '', $class = '')  line: 269
Renders a link with one additional URL parameter.

Renders an link invoking an admin-side action while taking up to one
additional URL parameter.

return: string HTML
param: string $event Event
param: string $step  Step
param: string $thing URL parameter key
param: string $value URL parameter value
param: string $class HTML class attribute
dLink($event, $step, $thing, $value, $verify = '', $thing2 = '', $thing2val = '', $get = '', $remember = null)  line: 293
Renders a delete link.

Renders a link invoking an admin-side "delete" action while taking up to two
additional URL parameters.

return: string HTML
param: string $event     Event
param: string $step      Step
param: string $thing     URL parameter key #1
param: string $value     URL parameter value #1
param: string $verify    Show an "Are you sure?" dialogue with this text
param: string $thing2    URL parameter key #2
param: string $thing2val URL parameter value #2
param: bool   $get       If TRUE, uses GET request
param: array  $remember  Convey URL parameters for page state. Member sequence is $page, $sort, $dir, $crit, $search_method
aLink($event, $step, $thing = '', $value = '', $thing2 = '', $value2 = '')  line: 382
Renders an add link.

This function can be used for invoking an admin-side "add" action while
taking up to two additional URL parameters.

return: string HTML
param: string $event  Event
param: string $step   Step
param: string $thing  URL parameter key #1
param: string $value  URL parameter value #1
param: string $thing2 URL parameter key #2
param: string $value2 URL parameter value #2
prevnext_link($name, $event, $step, $id, $title = '', $rel = '')  line: 408
Renders a link invoking an admin-side "previous/next article" action.

return: string HTML
param: string $name  Link text
param: string $event Event
param: string $step  Step
param: int    $id    ID of target Textpattern object (article,...)
param: string $title HTML title attribute
param: string $rel   HTML rel attribute
PrevNextLink($event, $page, $label, $type, $sort = '', $dir = '', $crit = '', $search_method = '', $step = 'list')  line: 433
Renders a link invoking an admin-side "previous/next page" action.

return: string HTML
param: string $event         Event
param: int    $page          Target page number
param: string $label         Link text
param: string $type          Direction, either "prev" or "next"
param: string $sort          Sort field
param: string $dir           Sort direction, either "asc" or "desc"
param: string $crit          Search criterion
param: string $search_method Search method
param: string $step          Step
nav_form($event, $page, $numPages, $sort = '', $dir = '', $crit = '', $search_method = '', $total = 0, $limit = 0, $step = 'list', $list = 5)  line: 468
Renders a page navigation form.

return: string HTML
param: string $event         Event
param: int    $page          Current page number
param: int    $numPages         Total pages
param: string $sort          Sort criterion
param: string $dir           Sort direction, either "asc" or "desc"
param: string $crit          Search criterion
param: string $search_method Search method
param: int    $total         Total search term hit count [0]
param: int    $limit         First visible search term hit number [0]
param: string $step             Step
param: int    $list          Number of displayed page links discounting jump links, previous and next
wrapRegion($id, $content = '', $anchor_id = '', $label = '', $pane = '', $class = '', $help = '')  line: 580
Wraps a collapsible region and group structure around content.

return: string HTML
param: string $id        HTML id attribute for the region wrapper and ARIA label
param: string $content   Content to wrap. If empty, only the outer wrapper will be rendered
param: string $anchor_id HTML id attribute for the collapsible wrapper
param: string $label     L10n label name
param: string $pane      Pane reference for maintaining toggle state in prefs. Prefixed with 'pane_', suffixed with '_visible'
param: string $class     CSS class name to apply to wrapper
param: string $help      Help text item
wrapGroup($id, $content, $label, $class = '', $help = '')  line: 637
Wraps a region and group structure around content.

return: string HTML
param: string $name    HTML id attribute for the group wrapper and ARIA label
param: string $content Content to wrap
param: string $label   L10n label name
param: string $class   CSS class name to apply to wrapper
param: string $help    Help text item
startSkelTable()  line: 655
Renders start of a layout <table> element.

return: string HTML
startTable($id = '', $align = '', $class = '', $p = 0, $w = 0)  line: 668
Renders start of a layout <table> element.

return: string HTML
param: string $id    HTML id attribute
param: string $align HTML align attribute
param: string $class HTML class attribute
param: int    $p     HTML cellpadding attribute
param: int    $w     HTML width atttribute
endTable()  line: 697
Renders closing </table> tag.

return: string HTML
stackRows()  line: 708
Renders <tr> elements from input parameters.

Takes a list of arguments containing each making a row.

return: string HTML
td($content = '', $width = null, $class = '', $id = '')  line: 730
Renders a <td> element.

return: string HTML
param: string $content Cell content
param: int    $width   HTML width attribute
param: string $class   HTML class attribute
param: string $id      HTML id attribute
tda($content, $atts = '')  line: 754
Renders a <td> element with attributes.

return: string HTML
param: string       $content Cell content
param: string|array $atts    Cell attributes
tdtl($content, $atts = '')  line: 769
Renders a <td> element with attributes.

This function is identical to tda().

return: string HTML
param: string       $content Cell content
param: string|array $atts    Cell attributes
tr($content, $atts = '')  line: 786
Renders a <tr> element with attributes.

return: string HTML
param: string       $content Row content
param: string|array $atts    Row attributes
tdcs($content, $span, $width = null, $class = '')  line: 799
Renders a <td> element with top/left text orientation, colspan and
other attributes.

return: string HTML
param: string $content Cell content
param: int    $span    Cell colspan attribute
param: int    $width   Cell width attribute
param: string $class   Cell class attribute
tdrs($content, $span, $width = null, $class = '')  line: 824
Renders a <td> element with a rowspan attribute.

return: string HTML
param: string $content Cell content
param: int    $span    Cell rowspan attribute
param: int    $width   Cell width attribute
param: string $class   Cell class attribute
fLabelCell($text, $help = '', $label_id = '')  line: 848
Renders a form label inside a table cell.

return: string HTML
param: string $text     Label text
param: string $help     Help text
param: string $label_id HTML "for" attribute, i.e. id of corresponding form element
fInputCell($name, $var = '', $tabindex = 0, $size = 0, $help = false, $id = '')  line: 868
Renders a form input inside a table cell.

return: string HTML
param: string $name     HTML name attribute
param: string $var      Input value
param: int    $tabindex HTML tabindex attribute
param: int    $size     HTML size attribute
param: bool   $help     TRUE to display help link
param: string $id       HTML id attribute
inputLabel($name, $input, $label = '', $help = array()  line: 887
Renders a name-value input control with label.

The rendered input can be customised via the
'{$event}_ui > inputlabel.{$name}' pluggable UI callback event.

return: string HTML
param: string       $name        Input name
param: string       $input       Complete input control widget
param: string|array $label       Label text | array (label text, HTML block to append to label)
param: string|array $help        Help text item | array(help text item, inline help text)
param: string|array $atts        Class name | attribute pairs to assign to container div
param: string|array $wraptag_val Tag to wrap the value / label in, or empty to omit
tag($content, $tag, $atts = '')  line: 970
Renders anything as an XML element.

return: string HTML
param: string       $content Enclosed content
param: string       $tag     The tag without brackets
param: string|array $atts    The element's HTML attributes
tag_void($tag, $atts = '')  line: 986
Renders anything as a HTML void element.

return: string HTML
param: string $tag  The tag without brackets
param: string|array $atts HTML attributes
tag_start($tag, $atts = '')  line: 1002
Renders anything as a HTML start tag.

return: string A HTML start tag
param: string $tag The tag without brackets
param: string|array $atts HTML attributes
tag_end($tag line: 1018
Renders anything as a HTML end tag.

return: string A HTML end tag
param: string $tag The tag without brackets
graf($item, $atts = '')  line: 1033
Renders a <p> element.

return: string HTML
param: string       $item Enclosed content
param: string|array $atts HTML attributes
hed($item, $level, $atts = '')  line: 1048
Renders a <hx> element.

return: string HTML
param: string       $item  The Enclosed content
param: int          $level Heading level 1...6
param: string|array $atts  HTML attributes
href($item, $href, $atts = '')  line: 1064
Renders an <a> element.

return: string HTML
param: string       $item Enclosed content
param: string|array $href The link target
param: string|array $atts HTML attributes
strong($item, $atts = '')  line: 1088
Renders a <strong> element.

return: string HTML
param: string       $item Enclosed content
param: string|array $atts HTML attributes
span($item, $atts = '')  line: 1101
Renders a <span> element.

return: string HTML
param: string       $item Enclosed content
param: string|array $atts HTML attributes
htmlPre($item, $atts = '')  line: 1114
Renders a <pre> element.

return: string HTML
param: string       $item The input string
param: string|array $atts HTML attributes
comment($item line: 1133
Renders a HTML comment (<!-- -->) element.

return: string HTML
param: string $item The input string
small($item, $atts = '')  line: 1147
Renders a <small&gt element.

return: string HTML
param: string       $item The input string
param: string|array $atts HTML attributes
assRow($array, $atts = '')  line: 1160
Renders a table data row from an array of content => width pairs.

return: string A HTML table row
param: array        $array Array of content => width pairs
param: string|array $atts  Table row atrributes
assHead()  line: 1179
Renders a table head row from an array of strings.

Takes an argument list of head text strings. i18n is applied to the strings.

return: string HTML
popHelp($help_var, $width = 0, $height = 0, $class = 'pophelp')  line: 1199
Renders the ubiquitious popup help button.

The rendered link can be customised via a 'admin_help > {$help_var}'
pluggable UI callback event.

return: string HTML
param: string $help_var Help topic
param: int    $width    Popup window width
param: int    $height   Popup window height
param: string $class    HTML class
fieldHelp($help_var line: 1231
Renders inline help text.

The help topic is the name of a string that can be found in txp_lang.

The rendered link can be customised via a 'admin_help_field > {$help_var}'
pluggable UI callback event.

return: string HTML
param: string $help_var   Help topic
popHelpSubtle($help_var, $width = 0, $height = 0)  line: 1263
Renders the ubiquitious popup help button with a little less visual noise.

The rendered link can be customised via a 'admin_help > {$help_var}'
pluggable UI callback event.

return: string HTML
param: string $help_var Help topic
param: int    $width    Popup window width
param: int    $height   Popup window height
popTag($var, $text, $atts = array()  line: 1280
Renders a link that opens a popup tag area.

return: string HTML
param: string $var   Tag name
param: string $text  Link text
param: array  $atts  Attributes to add to the link
popTagLinks($type line: 1301
Renders a list of tag builder links.

return: string HTML
param: string $type Tag type
messenger($thing, $thething = '', $action = '')  line: 1325
Renders an admin-side message text.

return: string HTML
param: string $thing    Subject
param: string $thething Predicate (strong)
param: string $action   Object
multi_edit($options, $event = null, $step = null, $page = '', $sort = '', $dir = '', $crit = '', $search_method = '')  line: 1339
Renders a multi-edit form listing editing methods.

return: string  HTML
param: array   $options       array('value' => array( 'label' => '', 'html' => '' ),...)
param: string  $event         Event
param: string  $step          Step
param: int     $page          Page number
param: string  $sort          Column sorted by
param: string  $dir           Sorting direction
param: string  $crit          Search criterion
param: string  $search_method Search method
pageby_form($event, $val, $step = null)  line: 1401
Renders a widget to select various amounts to page lists by.

The rendered options can be changed via a '{$event}_ui > pageby_values'
callback event.

return: string HTML
param: string      $event Event
param: int         $val   Current setting
param: string|null $step  Step
upload_form($label, $pophelp = '', $step, $event, $id = '', $max_file_size = 1000000, $label_id = '', $class = '', $wraptag_val = array('div', 'div')  line: 1453
Renders an upload form.

The rendered form can be customised via the '{$event}_ui > upload_form'
pluggable UI callback event.

return: string HTML
param: string       $label         File name label. May be empty
param: string       $pophelp       Help item
param: string       $step          Step
param: string       $event         Event
param: string       $id            File id
param: int          $max_file_size Maximum allowed file size
param: string       $label_id      HTML id attribute for the filename input element
param: string       $class         HTML class attribute for the form element
param: string|array $wraptag_val   Tag to wrap the value / label in, or empty to omit
search_form($event, $step, $crit, $methods, $method, $default_method line: 1528
Renders an admin-side search form.

return: string HTML
param: string $event          Event
param: string $step           Step
param: string $crit           Search criterion
param: array  $methods        Valid search methods
param: string $method         Actual search method
param: string $default_method Default search method
pref_text($name, $val, $id = '')  line: 1555
Renders a dropdown for selecting Textfilter method preferences.

return: string HTML
param: string $name Element name
param: string $val  Current value
param: string $id   HTML id attribute for the select input element
dom_attach($id, $content, $noscript = '', $wraptag = 'div', $wraptagid = '')  line: 1572
Attaches a HTML fragment to a DOM node.

return: string HTML/JS
param: string $id        Target DOM node's id
param: string $content   HTML fragment
param: string $noscript  Noscript alternative
param: string $wraptag   Wrapping HTML element
param: string $wraptagid Wrapping element's HTML id
script_js($js, $flags = '', $route = array()  line: 1600
Renders a &lt:script> element.

The $route parameter allows script_js() to be included in fixed page
locations (e.g. prior to the </body> tag) but to only render
its content if the event / step match.

return: string HTML with embedded script element
param: string     $js    JavaScript code
param: int|string $flags Flags TEXTPATTERN_SCRIPT_URL | TEXTPATTERN_SCRIPT_ATTACH_VERSION, or noscript alternative if a string
param: array      $route Optional events/steps upon which to add the script
toggle_box($classname, $form = false)  line: 1654
Renders a "Details" toggle checkbox.

return: string HTML
param: string $classname Unique identfier. The cookie's name will be derived from this value
param: bool   $form      Create as a stand-along <form> element
cookie_box($classname, $form = true)  line: 1696
Renders a checkbox to set/unset a browser cookie.

return: string HTML
param: string $classname Label text. The cookie's name will be derived from this value
param: bool   $form      Create as a stand-along <form> element
fieldset($content, $legend = '', $id = '')  line: 1758
Renders a <fieldset> element.

return: string HTML
param: string $content Enclosed content
param: string $legend  Legend text
param: string $id      HTML id attribute
asyncHref($item, $parms, $atts = '')  line: 1772
Renders a link element to hook up txpAsyncHref() with request parameters.

See this function's JavaScript companion, txpAsyncHref(), in textpattern.js.

return: string HTML
param: string       $item  Link text
param: array        $parms Request parameters; array keys are 'event', 'step', 'thing', 'property'
param: string|array $atts  HTML attributes
doWrap($list, $wraptag, $break, $class = '', $breakclass = '', $atts = '', $breakatts = '', $id = '')  line: 1813
Renders an array of items as a HTML list.

This function is used for tag handler functions. Creates a HTML list markup
from an array of items.

return: string HTML
param: array  $list
param: string $wraptag    The HTML element
param: string $break      The HTML break element
param: string $class      Class applied to the wraptag
param: string $breakclass Class applied to break tag
param: string $atts       HTML attributes applied to the wraptag
param: string $breakatts  HTML attributes applied to the break tag
param: string $id         HTML id applied to the wraptag
doTag($content, $tag, $class = '', $atts = '', $id = '')  line: 1865
Renders anything as a HTML tag.

Used for tag handler functions.

If $content is empty, renders a self-closing tag.

return: string HTML
param: string $content The wrapped item
param: string $tag     The HTML tag
param: string $class   HTML class
param: string $atts    HTML attributes
param: string $id      HTML id
doLabel($label = '', $labeltag = '')  line: 1900
Renders a label.

This function is mostly used for rendering headings in tag handler functions.

If no $labeltag is given, label is separated from the content with
a <br>.

return: string HTML
param: string $label    The label
param: string $labeltag The HTML element

title

Body