@@ -487,7 +487,7 @@ public function has_content( $name, $struct = array() ) {
487487 */
488488 public function compile_part ( $ struct ) {
489489 $ this ->open_tag ( $ struct );
490- if ( ! $ this -> is_void_element ( $ struct ['element ' ] ) ) {
490+ if ( ! self :: is_void_element ( $ struct ['element ' ] ) ) {
491491 $ this ->add_content ( $ struct ['content ' ] );
492492 if ( ! empty ( $ struct ['children ' ] ) ) {
493493 foreach ( $ struct ['children ' ] as $ child ) {
@@ -507,7 +507,7 @@ public function compile_part( $struct ) {
507507 */
508508 protected function open_tag ( $ struct ) {
509509 if ( ! empty ( $ struct ['element ' ] ) ) {
510- $ this ->html [] = $ this -> build_tag ( $ struct ['element ' ], ' open ' , $ struct ['attributes ' ] );
510+ $ this ->html [] = self :: build_tag ( $ struct ['element ' ], $ struct ['attributes ' ] );
511511 }
512512 }
513513
@@ -518,7 +518,7 @@ protected function open_tag( $struct ) {
518518 */
519519 protected function close_tag ( $ struct ) {
520520 if ( ! empty ( $ struct ['element ' ] ) ) {
521- $ this ->html [] = $ this -> build_tag ( $ struct ['element ' ], ' close ' , $ struct ['attributes ' ] );
521+ $ this ->html [] = self :: build_tag ( $ struct ['element ' ], $ struct ['attributes ' ], ' close ' );
522522 }
523523 }
524524
@@ -543,7 +543,7 @@ protected function add_content( $content ) {
543543 *
544544 * @return bool
545545 */
546- public function is_void_element ( $ element ) {
546+ public static function is_void_element ( $ element ) {
547547 $ void_elements = array (
548548 'area ' ,
549549 'base ' ,
@@ -568,20 +568,20 @@ public function is_void_element( $element ) {
568568 * Build an HTML tag.
569569 *
570570 * @param string $element The element to build.
571- * @param string $state The element state.
572571 * @param array $attributes The attributes for the tags.
572+ * @param string $state The element state.
573573 *
574574 * @return string
575575 */
576- protected function build_tag ( $ element , $ state , $ attributes = array () ) {
576+ public static function build_tag ( $ element , $ attributes = array (), $ state = ' open ' ) {
577577
578578 $ prefix_element = 'close ' === $ state ? '/ ' : '' ;
579579 $ tag = array ();
580580 $ tag [] = $ prefix_element . $ element ;
581581 if ( 'close ' !== $ state ) {
582582 $ tag [] = self ::build_attributes ( $ attributes );
583583 }
584- $ tag [] = $ this -> is_void_element ( $ element ) ? '/ ' : null ;
584+ $ tag [] = self :: is_void_element ( $ element ) ? '/ ' : null ;
585585
586586 return self ::compile_tag ( $ tag );
587587 }
0 commit comments