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 |
|---|
stringThe key/name assigned to the method when added
mixedArguements 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 |
|---|
stringThe name of the class the filter is in
stringThe method the filter is in
mixedThe data that is being passed to the filter
arrayoptions 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 |
|---|
stringThe name of the class the adapter is in
stringTHe 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 |
|---|
stringThe associated method
\boolea$hasAdapter Returns true if it has an adapter or false if it doesn not
_hasFilter(string $class, string $method)
stringThe class the filter is in
stringThe method of the class that the filter is in
_invokeMethod(string $class, string $method, array $args) : mixed
| access |
protected |
|---|
stringThe name of the class to be called
stringThe name of the method in the class to be called
arrayAn 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 |
|---|
stringThe name of the class to be called
stringThe name of the method in the class to be called
arrayAn 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 |
|---|
arrayThe data in the adapter
_logFilter(array $data) : void
| access |
private |
|---|
arrayThe data in the filter
_logObserver(array $data) : void
| access |
private |
|---|
arrayThe data in the observer
_notify(string $event) : void
| access |
protected |
|---|
stringThe 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 |
stringThe class that contains the function the adapter will respond too
stringThe method called that will have the adapter to be called.
stringThe new class to be called that has the same method name
arrayAn 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 |
mixedThis 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.
stringThe 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.
arrayOptions 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 |
|---|
stringThe name of the class the filter is going in
stringThe name of the method the filter is in
stringThe class that the filter resides in.
stringThe method in the class that the parameters will be passed too.
arrayOptions 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 |
|---|
stringThe key/value that will be used to call the function
\functionThe anonymous function/closure to be added
addObserver(string $event, string $class, string $method, array $options = array()) : void
| access |
public |
|---|
stringThe name of the event that will cause a certain class and method to fire
stringThe name of the class that contains the function that will be fired for this event
stringThe name of the method that will be fired when the event occurs
arrayOptions 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 |
stringThe information that will be displayed inside the address tag
arrayAttributes 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 |
|---|
mixedAny 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 |
stringThe key/index to assign the value to
mixedData to be stored in the collection
alink(string $title, mixed $url, array $options = array()) : string
| see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() \PVRouter::url() |
|---|---|
| access |
public |
stringThe title of link that the user will see
mixedA 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.
arrayAttributes 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 |
stringThe information that will be displayed inside the article tag
arrayAttributes 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 |
stringThe information that will be displayed inside the aside tag
arrayAttributes 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 |
|---|
stringThe location of the audio file to be played. Will be rendered by self::audioContentURL() function
arrayOptions 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 |
|---|
stringurl of the file
booleanAppends the PV_AUDIo tage
string
canvas(string $data, array $options = array()) : string
| see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
|---|---|
| access |
public |
stringThe information that will be displayed inside the canvas tag
arrayAttributes 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 |
|---|
stringThe class the filter is in
stringThe method of the class that the filter is in
clearObservers(string $event) : void
| access |
public |
|---|
stringThe event to remove all the observers from
details(string $data, array $options = array()) : string
| see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
|---|---|
| access |
public |
stringThe information that will be displayed inside the details tag
arrayAttributes 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 |
stringThe information thatwill be displayed inside the div
arrayAttributes 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())
stringThe name of the tag, such as div, main, etc.
stringThe content that will go instead the element
arrayOptions 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 |
|---|
stringThe index to retrieve a value from
mixed$data The data that was stored at that index
getEventAttributes(array $attributes = array()) : string
arrayAn array of attributes check if its an event
stringHtml attributes if any matched
getInstance() : object
| access |
public |
|---|---|
object$instance Returns the instance of a class.
getIterator() : \PVIterator
getMediaEventAttributes(array $attributes = array()) : string
arrayAn array of attributes to assign
stringHtml attributes if any matched
getStandardAttributes(array $attributes = array()) : string
| access |
public |
|---|
arrayAttribues 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
arrayAn array of attributes to assign
stringHtml attributes if any matched
h1(string $data, array $options = array()) : string
| see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
|---|---|
| access |
public |
stringThe information that will be displayed inside the heaader tag
arrayAttributes 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 |
stringThe information that will be displayed inside the heaader tag
arrayAttributes 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 |
stringThe information that will be displayed inside the heaader tag
arrayAttributes 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 |
stringThe information that will be displayed inside the heaader tag
arrayAttributes 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 |
stringThe information that will be displayed inside the heaader tag
arrayAttributes 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 |
stringThe information that will be displayed inside the heaader tag
arrayAttributes 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 |
stringThe source of the iframe
stringThe data to inside the iframe take
arrayAttributes 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 |
stringEither a url of the image or the path to the image in the PV_IMAGE define location
arrayAttributes 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 |
stringThe information that will be displayed inside the li tag
arrayAttributes 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 |
mixedA 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.
arrayAttributes 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 |
stringThe information that will be displayed inside the ol tag
arrayAttributes 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 |
stringThe information that will be displayed inside the paragraph tag
arrayAttributes 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 |
stringThe current value for the progress bar
stringThe max value for the progress bar
arrayOptions 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 |
|---|
stringThe associated method
removeClassAdapter( $class) : void
| access |
public |
|---|
set(string $index, mixed $value) : void
| access |
public |
|---|
stringThe key or index to store the value at
mixedA mixed value that can be anytype
setAdapterTrace(boolean $trace = false) : void
| access |
public |
|---|
booleanDefault is false. If set to true, will trace adatper.
setFilterTrace(boolean $trace = false) : void
| access |
public |
|---|
booleanDefault is false. If set to true, will trace filter.
setObserverTrace(boolean $trace = false) : void
| access |
public |
|---|
booleanDefault is false. If set to true, will trace observer.
span(string $data, array $options = array()) : string
| see | \PVHtml::getEventAttributes() \PVHtml::getStandardAttributes() |
|---|---|
| access |
public |
stringThe information that will be displayed inside the span tag
arrayAttributes 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 |
stringThe information that will be displayed inside the strong tag
arrayAttributes 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 |
stringThe information that will be displayed inside the strong tag
arrayAttributes 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 |
stringA time value
arrayAttributes 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 |
stringThe information that will be displayed inside the ul tag
arrayAttributes 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 |
|---|
stringThe location of the video file to be played. Will be rendered by self::videoContentURL() function
arrayOptions 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 |
|---|
stringurl of the file
booleanAppends the PV_AUDIo tage
string
_collection :
_methods :
_adapters :
_observers :
_instances :
_filters :
_traceAdapters :
_traceFilters :
_traceObservers :