src/bbn/html/element.php
public function html($with_js = 1)
	{
    $html = '';
		if ( $this->tag ){
			$this->update();
      // TAG
			$html .= '<'.$this->tag;

      foreach ( $this->attr as $key => $val ){
        if ( \is_string($key) ){
          $html .= ' '.htmlspecialchars($key).'="';
          if ( is_numeric($val) ){
            $html .= $val;
          }
          else if (\is_string($val) ){
            $html .= htmlspecialchars($val);
          }
          $html .= '"';
        }
      }
			
      if ( \count($this->css) > 0 ){
				$html .= self::css_to_string($this->css);
			}
      if ( $this->xhtml ){
        $html .= ' /';
      }
      $html .= '>';

			
			if ( !\in_array($this->tag, self::$self_closing_tags) ){

        if ( isset($this->text) ){
          $html .= $this->text;
        }
        
        if ( isset($this->content) ){
          // @todo: Add the ability to imbricate elements
          if ( \is_string($this->content) ){
            $html .= $this->content;
          }
          else if ( \is_array($this->content) ){
            foreach ( $this->content as $c ){
              if ( \is_array($c) ){
                $c = new bbn\html\element($c);
              }
              $html .= $c->html($with_js);
            }
          }
        }
				$html .= '</'.$this->tag.'>';
			}
			
			if ( isset($this->placeholder) && strpos($this->placeholder,'%s') !== false ){
				$html = sprintf($this->placeholder, $html);
			}
      
		}
		return $html;
	}
public function html($with_js = 1)
	{
    $html = '';
		if ( $this->tag ){
			$this->update();
      // TAG
			$html .= '<'.$this->tag;

      foreach ( $this->attr as $key => $val ){
        if ( \is_string($key) ){
          $html .= ' '.htmlspecialchars($key).'="';
          if ( is_numeric($val) ){
            $html .= $val;
          }
          else if (\is_string($val) ){
            $html .= htmlspecialchars($val);
          }
          $html .= '"';
        }
      }
			
      if ( \count($this->css) > 0 ){
				$html .= self::css_to_string($this->css);
			}
      if ( $this->xhtml ){
        $html .= ' /';
      }
      $html .= '>';

			
			if ( !\in_array($this->tag, self::$self_closing_tags) ){

        if ( isset($this->text) ){
          $html .= $this->text;
        }
        
        if ( isset($this->content) ){
          // @todo: Add the ability to imbricate elements
          if ( \is_string($this->content) ){
            $html .= $this->content;
          }
          else if ( \is_array($this->content) ){
            foreach ( $this->content as $c ){
              if ( \is_array($c) ){
                $c = new bbn\html\element($c);
              }
              $html .= $c->html($with_js);
            }
          }
        }
				$html .= '</'.$this->tag.'>';
			}
			
			if ( isset($this->placeholder) && strpos($this->placeholder,'%s') !== false ){
				$html = sprintf($this->placeholder, $html);
			}
      
		}
		return $html;
	}
public function html ( $ with_js = 1 ) { $ html = '' ; if ( $ this -> tag ) { $ this -> update ( ) ; // TAG $ html .= '<' . $ this -> tag ; foreach ( $ this -> attr as $ key => $ val ) { if ( \ is_string ( $ key ) ) { $ html .= ' ' . htmlspecialchars ( $ key ) . '="' ; if ( is_numeric ( $ val ) ) { $ html .= $ val ; } else if ( \ is_string ( $ val ) ) { $ html .= htmlspecialchars ( $ val ) ; } $ html .= '"' ; } } if ( \ count ( $ this -> css ) > 0 ) { $ html .= self :: css_to_string ( $ this -> css ) ; } if ( $ this -> xhtml ) { $ html .= ' /' ; } $ html .= '>' ; if ( ! \ in_array ( $ this -> tag , self :: $ self_closing_tags ) ) { if ( isset ( $ this -> text ) ) { $ html .= $ this -> text ; } if ( isset ( $ this -> content ) ) { // @todo: Add the ability to imbricate elements if ( \ is_string ( $ this -> content ) ) { $ html .= $ this -> content ; } else if ( \ is_array ( $ this -> content ) ) { foreach ( $ this -> content as $ c ) { if ( \ is_array ( $ c ) ) { $ c = new bbn \ html \ element ( $ c ) ; } $ html .= $ c -> html ( $ with_js ) ; } } } $ html .= '</' . $ this -> tag . '>' ; } if ( isset ( $ this -> placeholder ) && strpos ( $ this -> placeholder , '%s' ) !== false ) { $ html = sprintf ( $ this -> placeholder , $ html ) ; } } return $ html ; }
Returns the corresponding HTML string

@param bool $with_js Includes the javascript
@return string HTML string
Returns the corresponding HTML string