PVHTML is a class designed for generating HTML elements to display to the user.
The class takes in basic HTML forms with options. The functionality can be used with dynamic form generation tools.
Example:
//Create array of links
$links = array('Google', 'http://www.google.com', 'Facebook', 'http://www.facebook.com');
$html = '';
$li = '';
foreach($links as $key => $value):
$li .= PVHtml::li(PVHtml::ahref($key, $value));
endforeach;
$html = PVHtml::ul($li);
$html = PVHtml::div($html, array('class' => 'container'));
echo $html;
//The following will be printed
<div class="container">
<ul>
<li><a href="http://www.google.com">Google</a><li>
<li><a href="http://www.facebook.com">Facebook</a><li>
</ul>
</div>
package |
template |
---|---|
todo |
Add more HTML5 form elements |
__callStatic(string $method, mixed $args = array()) : mixed
access |
public |
---|
string
The key/name assigned to the method when added
mixed
Arguements to pass to the annoymous function. The function is called using call_user_func_array.
mixed
$value The value returned is the value the stored function returns
_applyFilter(string $class, string $method, mixed $data, array $options = array()) : mixed
access |
protected |
---|
string
The name of the class the filter is in
string
The method the filter is in
mixed
The data that is being passed to the filter
array
options to be passed to the filter. Passed options we be passed to the function. -'default_return' mixed: If no filter is return, the data passed in by default will be return. Can be overriden -'event' string: An event to associate with the filter. Default is null
mixed
$data The data the function returns
_callAdapter(string $class, string $method) : mixed
access |
protected |
---|
string
The name of the class the adapter is in
string
THe name of the method the class is being called from.
mixed
$value A value that the adapter returns
_hasAdapter( $class, string $method) : \boolea
access |
protected |
---|
string
The associated method
\boolea
$hasAdapter Returns true if it has an adapter or false if it doesn not
_hasFilter(string $class, string $method)
string
The class the filter is in
string
The method of the class that the filter is in
_invokeMethod(string $class, string $method, array $args) : mixed
access |
protected |
---|
string
The name of the class to be called
string
The name of the method in the class to be called
array
An array of arguements. Arguements have to be embedded in an array to be called.
mixed
$data Data returned by the function called
_invokeStaticMethod(string $class, string $method, array $args) : mixed
access |
protected |
---|
string
The name of the class to be called
string
The name of the method in the class to be called
array
An array of arguements. Arguements have to be embedded in an array to be called.
mixed
$data Data returned by the function called
_logAdapter(array $data) : void
access |
private |
---|
array
The data in the adapter
_logFilter(array $data) : void
access |
private |
---|
array
The data in the filter
_logObserver(array $data) : void
access |
private |
---|
array
The data in the observer
_notify(string $event) : void
access |
protected |
---|
string
The name of the even that occured that will trigger notifies
_prepareLogData(array $data) : string
access |
private |
---|
array
string
$message JSON encode message of information about the data
addAdapter(string $trigger_class, string $trigger_method, string $call_class, array $options = array()) : void
access |
public |
---|---|
todo |
add ability to adapt singleton class |
string
The class that contains the function the adapter will respond too
string
The method called that will have the adapter to be called.
string
The new class to be called that has the same method name
array
An array of options that be called -'object' string : Assumes that default method in the class to be called is static. If called object needs to be instantiated, change to object to 'instance' and one will be created before the adapter calls the function -'call_method' string: By default the method to be called to override the current one should be the same name. But this can be ovveridden to call a different method. -'type' string: The type of method being called. Default is class_method but if the method is a closure, set the type to be 'closure' and make the $trigger_method the closure
addClassAdapter(mixed $trigger_class, string $call_class, array $options = array()) : void
access |
public |
---|---|
todo |
Add ability to use singleton classes |
mixed
This can either be the name of the class or an object whose methods will be adapted to another class. The class should be included or be autoloaded by this point.
string
The call class is the classes methods that will be called in place of the methods in the trigger_class. These class does not have to be included as this point.
array
Options that be used to further distinguish the behavior of the adapters added -'object' string: Determines if the object being adapted to is static or an instance.Default is static -'call_class' string: The name of the class that the methods will be adapted too. -'class' string: The name of the whose methods will be adapted to another class
addFilter(string $class, string $method, string $filter_class, string $filter_method, array $options = array()) : void
access |
public |
---|
string
The name of the class the filter is going in
string
The name of the method the filter is in
string
The class that the filter resides in.
string
The method in the class that the parameters will be passed too.
array
Options that can be set for further modifying the filter. -'object' string: If the method being called is static, static should be inserted. If its in an instance, 'instance' should be set. Default is set to static. -'event' string: Associate this filter with an event. -'type' string: The type of function being called. Default is class_method but if the function is a closure, set the type to be 'closure' and make the $filter_method the closure
addMethod(string $method, \function $closure) : void
access |
public |
---|
string
The key/value that will be used to call the function
\function
The anonymous function/closure to be added
addObserver(string $event, string $class, string $method, array $options = array()) : void
access |
public |
---|
string
The name of the event that will cause a certain class and method to fire
string
The name of the class that contains the function that will be fired for this event
string
The name of the method that will be fired when the event occurs
array
Options to further the define the firing of an event -'object' string : If the method being called is static, should be set to static. Else set to instance -'class' stinrg : The name of the class to be called. Default is the class that is passed in. -'method' string: The name of the method to be called. Default is the method that is passed in. -'type' string: The type of function being called. Default is class_method but if the function is a closure, set the type to be 'closure' and make the $method the closure
address(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the address tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$address The address element that was generated
addToCollection(mixed $data) : void
access |
public |
---|
mixed
Any data type( Object, Array, int, etc) to add to the public data collection
addToCollectionWithName(string $name, mixed $data) : void
access |
public |
---|---|
todo |
check the relevance of get and set |
string
The key/index to assign the value to
mixed
Data to be stored in the collection
alink(string $title, mixed $url, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() \PVRouter::url() |
---|---|
access |
public |
string
The title of link that the user will see
mixed
A url that the link will point too. If the url is an array or not a valid url, it will be passed to PVRouter::url.
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes -'charset' string: Value to go in the charset tag. -'hreflang' string: Value to go in the hreflang tag. -'name' string: Value tog go in the name attribute -'rel' string: Value to go in the rel attribute -'shape' string: Value to o in the shape attribute -'target' string: Value to in the target attribute
string
$link The link tag returned as a string
article(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the article tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$article The article element that was generated
aside(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the aside tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$aside The aside element that was generated
audio(string $src = '', array $options = array()) : string
access |
public |
---|
string
The location of the audio file to be played. Will be rendered by self::audioContentURL() function
array
Options that can be used to define attributes in the elements tag -'controls' string: The controls attributes. -'audio' 'string: THe audio attribute -'autoplay' string: Automatically play the video -'loop' string : Loop to play automatically -'poster' string : Poster attribute -'preload' string: Preload attribute -'wav_file' string: Location of the wav file -'mp3_file' string: The location of the mp3 file -'oga_file' string: Location of the oga file
string
$audio Returns the audio tag
audioContentURL(string $url, boolean $append_location = false) : string
todo |
check if function is still valid |
---|
string
url of the file
boolean
Appends the PV_AUDIo tage
string
canvas(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the canvas tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$aside The canvas element that was generated
clearFilters(string $class, string $method) : void
access |
public |
---|
string
The class the filter is in
string
The method of the class that the filter is in
clearObservers(string $event) : void
access |
public |
---|
string
The event to remove all the observers from
details(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the details tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$details The details element that was generated
div(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information thatwill be displayed inside the div
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$div The div element that was generated
generateHtmlTag(string $tag, string $data, array $options = array())
string
The name of the tag, such as div, main, etc.
string
The content that will go instead the element
array
Options than can be used to further distinguish the element. The options are the same values that will be passed through PVHTML::getStandardAttributes, PVHTML::getEventAttributes and get the self::getFormAttributes funtions
get(string $index) : mixed
access |
public |
---|
string
The index to retrieve a value from
mixed
$data The data that was stored at that index
getEventAttributes(array $attributes = array()) : string
array
An array of attributes check if its an event
string
Html attributes if any matched
getInstance() : object
access |
public |
---|---|
object
$instance Returns the instance of a class.
getIterator() : \PVIterator
getMediaEventAttributes(array $attributes = array()) : string
array
An array of attributes to assign
string
Html attributes if any matched
getStandardAttributes(array $attributes = array()) : string
access |
public |
---|
array
Attribues that will be assigned if they match -'class' string: The class attribute -'id' string: The class attribute -'dir' string: The class attribute -'lang' string: The class attribute -'style' string: The class attribute -'title' string: The class attribute -'title' string: The class attribute -'xml:lang' string: The class attribute -'accesskey' string: The class attribute -'contenteditable' string: The class attribute -'contextmenu' string: The class attribute -'draggable' string: The class attribute -'dropzone' string: The class attribute -'hidden' string: The class attribute -'spellcheck' string: The class attribute -'title' string: The class attribute
string
$attributes Returns the matched attributes as a string
getWindowAttributes(array $attributes = array()) : string
array
An array of attributes to assign
string
Html attributes if any matched
h1(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the heaader tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$header The header element that was generated
h2(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the heaader tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$header The header element that was generated
h3(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the heaader tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$header The header element that was generated
h4(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the heaader tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$header The header element that was generated
h5(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the heaader tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$header The header element that was generated
h6(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the heaader tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$header The header element that was generated
iframe(string $src, string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The source of the iframe
string
The data to inside the iframe take
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes -'frameborder' string: Tags to go in the frameborder -'marginheight' string: Tags to go in the marginheight -'marginwidth' string: Tags to go in the marginweidth -'scrolling' string: Tags to go in the scrolling -'longdesc' string: Tags to go in the longdesc
string
$iframe The iframe taged returned a time
image(string $location, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
Either a url of the image or the path to the image in the PV_IMAGE define location
array
Attributes that can be added to the image. includes self::getStandardAttributes and self::getEventAttributes -'image_width' double: The width of the image -'image_height' double: The height of the image -'width' double: The width of the image -'height' double: The height of the image -'alt' string: Value to go in the alt tag of the image -'longdesc' string: Value to go in the longdesc tag of the image -'usemap' string: Value to go in the usemap tag of an image
string
$image The image tag returned as a string
li(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the li tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$strong The strong element that was generated
link(mixed $url, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() \PVRouter::url() |
---|---|
access |
public |
mixed
A url that the link will point too. If the url is an array or not a valid url, it will be passed to PVRouter::url.
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes -'hreflang' string: Value to go in the hreflang tag. -'name' string: Value tog go in the name attribute -'rel' string: Value to go in the rel attribute -'media' string: Value to go in the media attribute. -'sizes' string: Value to in the sizes attribute
string
$link The link tag returned as a string
ol(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the ol tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$strong The strong element that was generated
p(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the paragraph tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$header The paragraph element that was generated
progress(string $value, string $max, array $options = array()) : string
see | \PVHTML::getStandardAttributes() \PVHTML::getEventAttributes() \PVHTML::getStandardAttributes() self::getFormAttributes() |
---|---|
access |
public |
string
The current value for the progress bar
string
The max value for the progress bar
array
Options than can be used to further distinguish the element. The options are the same values that will be passed through PVHTML::getStandardAttributes, PVHTML::getEventAttributes and get the self::getFormAttributes funtions
string
$element The string that creates the element
removeAdapter( $class, string $method) : void
access |
public |
---|
string
The associated method
removeClassAdapter( $class) : void
access |
public |
---|
set(string $index, mixed $value) : void
access |
public |
---|
string
The key or index to store the value at
mixed
A mixed value that can be anytype
setAdapterTrace(boolean $trace = false) : void
access |
public |
---|
boolean
Default is false. If set to true, will trace adatper.
setFilterTrace(boolean $trace = false) : void
access |
public |
---|
boolean
Default is false. If set to true, will trace filter.
setObserverTrace(boolean $trace = false) : void
access |
public |
---|
boolean
Default is false. If set to true, will trace observer.
span(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the span tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$header The span element that was generated
strong(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the strong tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$strong The strong element that was generated
summary(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the strong tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$summary The summary element that was generated
time(string $time, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
A time value
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes -'datetime' string: Tags to go in the datetime tags -'pubdate' string: Tags to go in the pubdate
string
$time The time taged returned a time
ul(string $data, array $options = array()) : string
see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
---|---|
access |
public |
string
The information that will be displayed inside the ul tag
array
Attributes that can be added to the element. includes self::getStandardAttributes and self::getEventAttributes
string
$strong The strong element that was generated
video(string $src = '', array $options = array()) : string
access |
public |
---|
string
The location of the video file to be played. Will be rendered by self::videoContentURL() function
array
Options that can be used to define attributes in the elements tag -'height' double: The height of the video -'width' width: The width of the video -'controls' string: The controls attributes. -'audio' 'string: THe audio attribute -'autoplay' string: Automatically play the video -'loop' string : Loop to play automatically -'poster' string : Poster attribute -'preload' string: Preload attribute -'mp4_file' string: Location of the mp4 file -'webm_file' string: The location of the webm file -'ogv_file' string: Location of the ogv file
string
$video Returns the video tag
videoContentURL(string $url, boolean $append_location = false) : string
todo |
check if function is still valid |
---|
string
url of the file
boolean
Appends the PV_AUDIo tage
string
_collection :
_methods :
_adapters :
_observers :
_instances :
_filters :
_traceAdapters :
_traceFilters :
_traceObservers :