WPDK  1.5.0
WordPress Development Kit
 All Data Structures Files Functions Variables Pages
WPDKHTMLTag Class Reference
Inheritance diagram for WPDKHTMLTag:
WPDKObject WPDKHTMLTagA WPDKHTMLTagButton WPDKHTMLTagFieldset WPDKHTMLTagForm WPDKHTMLTagImg WPDKHTMLTagInput WPDKHTMLTagLabel WPDKHTMLTagLegend WPDKHTMLTagSelect WPDKHTMLTagSpan WPDKHTMLTagTextarea WPDKUIAlert WPDKUIModalDialog WPDKUIPopover

Public Member Functions

 __construct ($tag_name)
 
 addData ($name, $value)
 Add data attribute. More...
 
 addClass ($class)
 Add CSS Class. More...
 
 display ()
 Display. More...
 
 html ()
 Return the HTML markup for this tag. More...
 
 draw ()
 Draw. More...
 
 setPropertiesByArray ($properties=array())
 Set properties by array. More...
 
- Public Member Functions inherited from WPDKObject
 __className ()
 Returns the class object. More...
 
 __parentClass ()
 Returns the class object for the receiver’s superclass. More...
 
 __isClass ($class)
 Brief. More...
 
 __isSubclassOfClass ($class)
 Return TRUE if the receiving class is a subclass of —or identical to— $class, otherwise FALSE. More...
 

Static Public Member Functions

static sanitizeAttributes ($attributes)
 Sanitize attributes. More...
 
static sanitizeData ($attributes)
 Sanitize data attributes. More...
 
static sanitizeClasses ($classes)
 Sanitize CSS Classes list. More...
 
static sanitizeStyles ($styles)
 Sanitize CSS Classes list. More...
 
static attributeInline ($attributes, $additional_attributes=false)
 Inline Data attribute. More...
 
static dataInline ($data, $additional_data=false)
 Inline Data attribute. More...
 
static classInline ($classes, $additional_classes=false)
 Inline CSS class. More...
 
static styleInline ($styles, $additional_styles=false)
 Inline CSS class. More...
 
static mergeClasses ($class, $class2=null, $_=null)
 Merge. More...
 
- Static Public Member Functions inherited from WPDKObject
static __delta ($last_version, $old_version)
 Object delta compare for combine. More...
 
static delta ($last_version, $old_version)
 
static __dump ($var, $monitor=false)
 Dump a variable. More...
 

Data Fields

 $__version = '1.1.1'
 Version. More...
 
 $accesskey = ''
 
 $class = array()
 
 $content = ''
 Content. More...
 
 $contenteditable
 
 $contextmenu
 
 $data = array()
 Data attribute. More...
 
 $dir
 
 $draggable
 
 $dropzone
 
 $hidden
 
 $id
 
 $lang
 
 $onclick
 
 $spellcheck
 
 $style
 
 $tabindex
 
 $tagName
 Tag name. More...
 
 $title
 
- Data Fields inherited from WPDKObject
 $__version = '1.0.0'
 The version number assigned to the class. More...
 

Protected Member Functions

 beforeContent ()
 Before content. More...
 
 afterContent ()
 After content. More...
 

Protected Attributes

 $attributes = array()
 Attributes list. More...
 
 $close
 Close tag. More...
 
 $open
 Open tag. More...
 

Detailed Description

Generic HTML model. This class is sub class from above class. Thanks to http://www.w3schools.com/tags/default.asp for definitions

Author
=undo= info@.nosp@m.wpxt.nosp@m.re.me
Date
2014-01-08
Version
1.1.1

Definition at line 13 of file wpdk-html-tag.php.

Constructor & Destructor Documentation

__construct (   $tag_name)

Create an instance of WPDKHTMLTag class

Parameters
string$tag_name
Returns
WPDKHTMLTag

Definition at line 125 of file wpdk-html-tag.php.

Member Function Documentation

addClass (   $class)

Add CSS Class.

Utility to add a class. You can access directly to class array property instead

Since
1.3.1
Parameters
string$class

Definition at line 173 of file wpdk-html-tag.php.

addData (   $name,
  $value 
)

Add data attribute.

Utility to add a data attribute. You can access directly to data array property instead

Parameters
string$nameData attribute name
string$valueData attribute value

Definition at line 158 of file wpdk-html-tag.php.

afterContent ( )
protected

After content.

Override this method to display anything after the content output

Definition at line 289 of file wpdk-html-tag.php.

static attributeInline (   $attributes,
  $additional_attributes = false 
)
static

Inline Data attribute.

Return a inline generic attribute

$data = array(
  'color' => 'red',
  'size'  => 12
);
echo self::attributeInline( $data, array( 'modal' => "true" ) );
// 'color="red" size="12" modal="true"'
Parameters
array$attributesKey value pairs array with data attribute list
array | bool$additional_attributesOptional. Additional data
Returns
string

Definition at line 478 of file wpdk-html-tag.php.

beforeContent ( )
protected

Before content.

Override this method to display anything before the content output

Definition at line 267 of file wpdk-html-tag.php.

static classInline (   $classes,
  $additional_classes = false 
)
static

Inline CSS class.

Return a sanitize and inline list of css classes

$classes = array(
  'color',
  'modal',
);
echo self::classInline( $classes, array( 'modal', 'hide' ) );
// 'color modal hide'

echo self::classInline( $classes, 'delta modal' );
// 'color delta modal'
Parameters
array | string$classesList of css classes
array | bool$additional_classesOptional. Additional classes
Returns
string

Definition at line 546 of file wpdk-html-tag.php.

static dataInline (   $data,
  $additional_data = false 
)
static

Inline Data attribute.

Return a inline data attribute

$data = array(
  'color' => 'red',
  'size'  => 12
);
echo self::dataInline( $data, array( 'modal' => "true" ) );
// 'data-color="red" data-size="12" data-modal="true"'
Parameters
array$dataKey value pairs array with data attribute list
array | bool$additional_dataOptional. Additional data
Returns
string

Definition at line 511 of file wpdk-html-tag.php.

display ( )

Display.

Display HTML markup for this tag

Definition at line 185 of file wpdk-html-tag.php.

draw ( )

Draw.

Draw the content of tag

Note
You can override this method in order to customize it

Definition at line 279 of file wpdk-html-tag.php.

html ( )

Return the HTML markup for this tag.

Return the HTML markup for this tag

Returns
string

Definition at line 197 of file wpdk-html-tag.php.

static mergeClasses (   $class,
  $class2 = null,
  $_ = null 
)
static

Merge.

Merge one or more class

Since
1.4.0
Parameters
array | string$classInitial string or array class to merge
array | string$class2Optional.
array | string$_Optional.
Returns
array

Definition at line 619 of file wpdk-html-tag.php.

static sanitizeAttributes (   $attributes)
static

Sanitize attributes.

Return a key value pairs array with generic attribute list

self::sanitizeAttributes( 'modal="false" modal="true" color=red' );
// array(2) { ["modal"]=> string(5) "true" ["color"]=> string(3) "red" }
Parameters
string$attributesAttribute inline
Returns
array

Definition at line 327 of file wpdk-html-tag.php.

static sanitizeClasses (   $classes)
static

Sanitize CSS Classes list.

Return key value pairs array unique with css class list. In this way you can unset a secified class. If the input is a string (space separate strings) will return an array with css classes.

$class = 'a b c c';
echo self::sanitizeClasses( $class );

array(
  'a' => 'a',
  'b' => 'b',
  'c' => 'c',
 )
Parameters
string | array$classesAny string or array with classes
Returns
array

Definition at line 403 of file wpdk-html-tag.php.

static sanitizeData (   $attributes)
static

Sanitize data attributes.

Return a key value pairs array with data attribute list

self::sanitizeAttributes( 'data-modal="false" modal="true" data-color=red' );
// array(2) { ["modal"]=> string(5) "true" ["color"]=> string(3) "red" }
Parameters
string$attributesData attribute inline
Returns
array

Definition at line 357 of file wpdk-html-tag.php.

static sanitizeStyles (   $styles)
static

Sanitize CSS Classes list.

Return key value pairs array unique with css styke list. In this way you can unset a secified class. If the input is a string (space separate strings) will return an array with css classes.

$style = 'display:block;position:absolute';
echo self::sanitizeStyles( $style );

array(
  'display'  => 'block',
  'position' => 'absolute',
 )
Since
1.4.7
Parameters
string | array$stylesAny string or array with styles
Returns
array

Definition at line 438 of file wpdk-html-tag.php.

setPropertiesByArray (   $properties = array())

Set properties by array.

Set one or more WPDKHTMLTag properties by an array.

Parameters
array$propertiesA key value pairs array with the property (key) and its value

Definition at line 301 of file wpdk-html-tag.php.

static styleInline (   $styles,
  $additional_styles = false 
)
static

Inline CSS class.

Return a sanitize and inline list of css styles

$styles = array(
  'position' => 'absolute',
  'top' => 0,
);
echo self::styleInline( $styles, array( 'left' => 0, 'display' => 'block' ) );
// 'position:absolute;top:0;left:0;display:block'

echo self::styleInline( $styles, 'display:block' );
// 'position:absolute;top:0;display:block'
Since
1.4.7
Parameters
array | string$stylesList of css styles
array | bool$additional_stylesOptional. Additional styles
Returns
string

Definition at line 583 of file wpdk-html-tag.php.

Field Documentation

string $__version = '1.1.1'

Version.

Override version

Definition at line 22 of file wpdk-html-tag.php.

$accesskey = ''

Here there are all late binding tag attributes. Image...

charset coords href classs ...

Definition at line 37 of file wpdk-html-tag.php.

array $attributes = array()
protected

Attributes list.

Override. List of tag attributes that can be used on any HTML element.

Definition at line 89 of file wpdk-html-tag.php.

$class = array()

Definition at line 38 of file wpdk-html-tag.php.

string $close
protected

Close tag.

Override. Close format Eg. '' or '/>'

Definition at line 98 of file wpdk-html-tag.php.

string $content = ''

Content.

HTML inner content of tag.

Definition at line 47 of file wpdk-html-tag.php.

$contenteditable

Definition at line 48 of file wpdk-html-tag.php.

$contextmenu

Definition at line 49 of file wpdk-html-tag.php.

array $data = array()

Data attribute.

Key value pairs array Attribute data: data-attribute = value

Definition at line 58 of file wpdk-html-tag.php.

$dir

Definition at line 59 of file wpdk-html-tag.php.

$draggable

Definition at line 60 of file wpdk-html-tag.php.

$dropzone

Definition at line 61 of file wpdk-html-tag.php.

$hidden

Definition at line 62 of file wpdk-html-tag.php.

$id

Definition at line 63 of file wpdk-html-tag.php.

$lang

Definition at line 64 of file wpdk-html-tag.php.

$onclick

Definition at line 65 of file wpdk-html-tag.php.

string $open
protected

Open tag.

Override. Open format Eg. '<a'

Definition at line 107 of file wpdk-html-tag.php.

$spellcheck

Definition at line 66 of file wpdk-html-tag.php.

$style

Definition at line 67 of file wpdk-html-tag.php.

$tabindex

Definition at line 68 of file wpdk-html-tag.php.

WPDKHTMLTagName $tagName

Tag name.

The TAG name

Definition at line 77 of file wpdk-html-tag.php.

$title

Definition at line 80 of file wpdk-html-tag.php.


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