Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • components
        • events
          • default
      • controllers
      • models
    • components
      • auth
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • exchange
        • rates
          • foxrate
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
      • json
      • modules
      • net
        • http
        • net
          • amazon
            • s3
          • geo
            • ip
      • plugins
      • recaptcha
      • security
      • session
        • cart
      • settingscollection
      • upgrades
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
  • com
    • tecnick
      • tcpdf
        • blesta
          • components
            • invoice
              • templates
                • quickbooks
                  • invoice
                • templates
                  • default
  • Crypt
    • AES
    • DES
    • Hash
    • Random
    • RC4
    • Rijndael
    • RSA
    • TerraDES
  • File
    • ANSI
    • ASN1
    • X509
  • Math
    • BigInteger
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • html
      • xml
    • lib
  • Net
    • SFTP
    • SSH1
    • SSH2
  • None
  • PHP
  • PHPMailer
  • Services
    • JSON
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Form
  • Html
  • Javascript
  • Pagination
  • Widget
  • WidgetClient

Class Form

Provides helper methods for dealing with HTML content

Html
Extended by Form
Package: minPHP\helpers\html
Located at helpers/form/form.php

Methods summary

public
# setEol( string $eol )

Sets the end of line character to use

Sets the end of line character to use

Parameters

$eol
string
$eol The end of line character to use
public
# setOutput( boolean $return )

Set whether to return $output generated by these methods, or to echo it out instead

Set whether to return $output generated by these methods, or to echo it out instead

Parameters

$return
boolean
$return True to return output from these form methods, false to echo results instead
public array
# collapseObjectArray( array $obj_arr, mixed $value_var, string $key_var = null, string $glue = null )

Collapses an object array down to a simple key/value array or numerically indexed array whose values are member variables of the given object array

Collapses an object array down to a simple key/value array or numerically indexed array whose values are member variables of the given object array

Parameters

$obj_arr
array
$obj_arr The object array to collapse
$value_var
mixed
$value_var A string representing the name of the member variable, or an array of member variable values to concatenate
$key_var
string
$key_var The name of the member variable to use as the key in the array, null for numerically indexed array
$glue
string
$glue The value to use to concat multiple $value_var values together, if null, will simply print only the first non-null value in $value_var

Returns

array
An array in key/value form
public string
# create( string $uri = null, array $attributes = array() )

Begins a new form. Default method='post', but $attributes may overwrite that.

Begins a new form. Default method='post', but $attributes may overwrite that.

Parameters

$uri
string
$uri The $uri for the form to post to, defaults to $_SERVER['REQUEST_URI']
$attributes
array
$attributes The attributes and values to add in the <form> tag, in key=value pairs

Returns

string
The HTML for the <form> tag, void if output enabled
public string
# end( string $end_str = null )

Ends a form, appends an optional $end_str

Ends a form, appends an optional $end_str

Parameters

$end_str
string
$end_str The string to add after the </form> tag

Returns

string
The </form> tag, void if output enabled
public string
# fields( array $fields )

Allows fields to be created from an array of fields.

Allows fields to be created from an array of fields.

Parameters

$fields
array
$fields An array of fields to set

Returns

string
The fields given, void if output enabled
public string
# label( string $name, string $for = null, array $attributes = null, boolean $preserve_tags = false )

Creates a label with the given name and marks it for the given field

Creates a label with the given name and marks it for the given field

Parameters

$name
string
$name The name of this label
$for
string
$for The ID of the form element this label is part of
$attributes
array
$attributes Attributes for this label
$preserve_tags
boolean
$preserve_tags True to preserve tags in the label name

Returns

string
The label specified, void if output enabled
public string
# fieldText( string $name, string $value = null, array $attributes = array() )

Creates a text input field

Creates a text input field

Parameters

$name
string
$name The name to set in the HTML name field
$value
string
$value The value to set in the HTML value field
$attributes
array
$attributes Attributes for this input field

Returns

string
The text field specified, void if output enabled
public string
# fieldHidden( string $name, string $value = null, array $attributes = array() )

Creates a hidden input field

Creates a hidden input field

Parameters

$name
string
$name The name to set in the HTML name field
$value
string
$value The value to set in the HTML value field
$attributes
array
$attributes Attributes for this input field

Returns

string
The hidden field specified, void if output enabled
public string
# fieldImage( string $name, string $value = null, array $attributes = array() )

Creates an image input field

Creates an image input field

Parameters

$name
string
$name The name to set in the HTML name field
$value
string
$value The value to set in the HTML value field
$attributes
array
$attributes Attributes for this input field

Returns

string
The image field specified, void if output enabled
public string
# fieldReset( string $name, string $value = null, array $attributes = array() )

Creates a reset input field

Creates a reset input field

Parameters

$name
string
$name The name to set in the HTML name field
$value
string
$value The value to set in the HTML value field
$attributes
array
$attributes Attributes for this input field

Returns

string
The reset field specified, void if output enabled
public string
# fieldCheckbox( string $name, string $value = null, boolean $checked = false, array $attributes = array() )

Creates a checkbox

Creates a checkbox

Parameters

$name
string
$name The name to set in the HTML name field
$value
string
$value The value to set in the HTML value field
$checked
boolean
$checked True to set this field as checked
$attributes
array
$attributes Attributes for this input field

Returns

string
The checkbox field specified, void if output enabled
public string
# fieldRadio( string $name, string $value = null, boolean $checked = false, array $attributes = array() )

Creates a radio box

Creates a radio box

Parameters

$name
string
$name The name to set in the HTML name field
$value
string
$value The value to set in the HTML value field
$checked
boolean
$checked True to set this field as checked
$attributes
array
$attributes Attributes for this input field

Returns

string
The radio field specified, void if output enabled
public string
# fieldTextarea( string $name, string $value = null, array $attributes = array() )

Creates a textarea field

Creates a textarea field

Parameters

$name
string
$name The name to set in the HTML name field
$value
string
$value The value to set in this textarea
$attributes
array
$attributes Attributes for this input field

Returns

string
The textarea field, void if output enabled
public string
# fieldPassword( string $name, array $attributes = array() )

Creates a password input field

Creates a password input field

Parameters

$name
string
$name The name to set in the HTML name field
$attributes
array
$attributes Attributes for this input field

Returns

string
The password field, void if output enabled
public string
# fieldFile( string $name, array $attributes = array() )

Creates a file input field

Creates a file input field

Parameters

$name
string
$name The name to set in the HTML name field
$attributes
array
$attributes Attributes for this input field

Returns

string
The file field, void if output enabled
public string
# fieldSelect( string $name, array $options = array(), mixed $selected_value = null, array $attributes = array(), array $option_attributes = array() )

Creates a select list

Creates a select list

Parameters

$name
string
$name The name to set in the HTML name field
$options
array
$options The options to place in this select list
$selected_value
mixed
$selected_value The option(s) to set as selected
$attributes
array
$attributes Attributes for this input field
$option_attributes
array
$option_attributes Attributes for each option to set. If single dimension will set the attributes for every option, if multi-dimensional will set option for each element key that matches in $options

Returns

string
The select field, void if output enabled
public string
# fieldMultiSelect( string $name, array $options = array(), string $selected_values = array(), array $attributes = array(), array $option_attributes = array() )

Creates a select list with multiple selectable options

Creates a select list with multiple selectable options

Parameters

$name
string
$name The name to set in the HTML name field
$options
array
$options The options to place in this select list
$selected_values
string
$selected_value The option to set as selected
$attributes
array
$attributes Attributes for this input field
$option_attributes
array
$option_attributes Attributes for each option to set. If single dimension will set the attributes for every option, if multi-dimensional will set option for each element key that matches in $options

Returns

string
The multi-select field, void if output enabled
public string
# fieldButton( string $name, string $value = null, array $attributes = array() )

Creates a button with default type=button, can be overriden by attirbutes

Creates a button with default type=button, can be overriden by attirbutes

Parameters

$name
string
$name The name to set in the HTML name field
$value
string
$value The value to set in the HTML value field
$attributes
array
$attributes Attributes for this input field

Returns

string
The button field, void if output enabled
public string
# fieldSubmit( string $name, string $value = null, array $attributes = array() )

Creates a button of type submit

Creates a button of type submit

Parameters

$name
string
$name The name to set in the HTML name field
$value
string
$value The value to set in the HTML value field
$attributes
array
$attributes Attributes for this input field

Returns

string
The submit field, void if output enabled
private string
# fieldInput( string $tag, string $type, string $name, string $value = null, array $attributes = array() )

Builds a field for input or button

Builds a field for input or button

Parameters

$tag
string
$tag The HTML tag of this input field ("input" or "button")
$type
string
$type The input type to set in the type field
$name
string
$name The name of this form field
$value
string
$value The value of this field
$attributes
array
$attributes A list of attributes to set for this field

Returns

string
The input or button field of the given type
private string
# selectOptions( array $options, array $selected_values = array(), array $attributes = array() )

Builds select options and optgroups if given. An optgroup will continue until the end of the select options, or until the next optgroup begins.

Builds select options and optgroups if given. An optgroup will continue until the end of the select options, or until the next optgroup begins.

Parameters

$options
array
$options A list of 'name'=>'value' options to set into <option> tags, if 'name' is 'optgroup' an <optgroup> tag is created instead
$selected_values
array
$selected_values Values corresponding to an option's value to set as selected
$attributes
array
$attributes Attributes for each option field

Returns

string
The option fields along with any optgroups
private string
# radioCheck( string $type, string $name, string $value = null, boolean $checked = false, array $attributes = array() )

Creates a radio or check box

Creates a radio or check box

Parameters

$type
string
$type The type of box to create: radio or checkbox
$name
string
$name The name to set in the HTML name field
$value
string
$value The value to set in the HTML value field
$checked
boolean
$checked True to set this box as checked
$attributes
array
$attributes Attributes for this input field

Returns

string
The radio or checkbox field
private string
# output( string $html )

Handles whether to output or return $html

Handles whether to output or return $html

Parameters

$html
string
$html The HTML to output/return

Returns

string
The HTML given, void if output enabled
private boolean
# inArray( mixed $needle, array $haystack, boolean $strict = false )

An alternative to PHP's in_array function that checks if $needle exists in $haystack

An alternative to PHP's in_array function that checks if $needle exists in $haystack

Parameters

$needle
mixed
$needle A value to look for
$haystack
array
$haystack An array of key=>value pairs
$strict
boolean
$strict True to also check the type of $needle in $haystack, false to ignore type (default false)

Returns

boolean
True if $needle is in $haystack, false otherwise

Methods inherited from Html

_(), addCondition(), buildAttributes(), concat(), hyperlink(), ifSet(), isUtf8(), safe()

Magic methods summary

Properties summary

private string $eol
#

The string to use as the end of line character

The string to use as the end of line character

private boolean $return_output
#

Whether or not to return output from various form methods

Whether or not to return output from various form methods

Properties inherited from Html

$xhtml

Blesta API documentation generated by ApiGen 2.8.0