Build html from an array.

@param string &$html
@param array  $array
@param int    $tab

@return void
171440
public static function buildFromArray(&$html, $array, $tab = 0)
    {
        $pad = '';
        if ($tab > 0) {
            $pad = str_pad($pad, $tab * 2, ' ', STR_PAD_LEFT);
        }

        if (!isset($array[1])) {
            $html .= $array[0]."\n";

            return;
        }

        if (!empty($array[0])) {
            $html .= $pad;
            $html .= '<'.$array[0].$array[1].'>';
            $html .= "\n";
        }

        if (!empty($array[2])) {
            $html .= $pad.'  ';
            $html .= $array[2];
            $html .= "\n";
        }

        if (isset($array[3]) && is_array($array[3])) {
            foreach ($array[3] as $child_array) {
                self::buildFromArray($html, $child_array, $tab + 1);
            }
        }

        if (!empty($array[0])) {
            $html .= $pad;
            $html .= '</'.$array[0].'>';
            $html .= "\n";
        }
    }
1234810
public function addTab(string $id, array $tab): void
	{
		$this->optionTabs[] = array_merge($tab, ['DIV' => $id]);
	}
331091
public function setHtml($html)
	{
		if (!$this->mpdf) {
			$this->init();
		}
		$this->mpdf->WriteHTML($html);
	}
923220
public function htmlAttributes($array)
    {
        if (!isset($array)) {
            return null;
        }
       
        $str = "";
        foreach ($array as $key => $value) {
            if (!isset($value) || $value === false) {
                continue;
            }
            
            if ($value === true) {
                $value = $key;
            }
            
            $str .= ' ' . $key . '="' . addcslashes($value, '"') . '"';
        }
        
        return trim($str);
    }
488466
function finalizeHtml($html, needHtmlText) {
  let returnValue;

  if (needHtmlText) {
    returnValue = $html[0].innerHTML;
  } else {
    const frag = document.createDocumentFragment();
    const childNodes = util.toArray($html[0].childNodes);
    const {length} = childNodes;

    for (let i = 0; i < length; i += 1) {
      frag.appendChild(childNodes[i]);
    }
    returnValue = frag;
  }

  return returnValue;
}
1125541
function finish_html() {
        global $OUTPUT;
        if (!$this->started_output) {
            //no data has been added to the table.
            $this->print_nothing_to_display();

        } else {
            // Print empty rows to fill the table to the current pagesize.
            // This is done so the header aria-controls attributes do not point to
            // non existant elements.
            $emptyrow = array_fill(0, count($this->columns), '');
            while ($this->currentrow < $this->pagesize) {
                $this->print_row($emptyrow, 'emptyrow');
            }

            echo html_writer::end_tag('tbody');
            echo html_writer::end_tag('table');
            echo html_writer::end_tag('div');
            $this->wrap_html_finish();

            // Paging bar
            if(in_array(TABLE_P_BOTTOM, $this->showdownloadbuttonsat)) {
                echo $this->download_buttons();
            }

            if($this->use_pages) {
                $pagingbar = new paging_bar($this->totalrows, $this->currpage, $this->pagesize, $this->baseurl);
                $pagingbar->pagevar = $this->request[TABLE_VAR_PAGE];
                echo $OUTPUT->render($pagingbar);
            }
        }
    }
1149113
public function copyToArray(array &$array)
    {
        parent::copyToArray($array);

        $array['action']               = LanguageUtility::toString($this->action);
        $array['service']              = LanguageUtility::convertArrayCopyableToArray($this->service);
        $array['client']               = LanguageUtility::convertArrayCopyableToArray($this->client);
        $array['clientIdAliasUsed']    = $this->clientIdAliasUsed;
        $array['display']              = LanguageUtility::toString($this->display);
        $array['maxAge']               = LanguageUtility::orZero($this->maxAge);
        $array['scopes']               = LanguageUtility::convertArrayOfArrayCopyableToArray($this->scopes);
        $array['uiLocales']            = $this->uiLocales;
        $array['claimsLocales']        = $this->claimsLocales;
        $array['claims']               = $this->claims;
        $array['acrEssential']         = $this->acrEssential;
        $array['acrs']                 = $this->acrs;
        $array['subject']              = $this->subject;
        $array['loginHint']            = $this->loginHint;
        $array['prompts']              = LanguageUtility::convertArrayToStringArray($this->prompts);
        $array['requestObjectPayload'] = $this->requestObjectPayload;
        $array['idTokenClaims']        = $this->idTokenClaims;
        $array['userInfoClaims']       = $this->userInfoClaims;
        $array['responseContent']      = $this->responseContent;
        $array['ticket']               = $this->ticket;
    }
195671
public static function alist(array $items, array $attributes = null, $tag = 'ul') {
        $output = html_writer::start_tag($tag, $attributes)."\n";
        foreach ($items as $item) {
            $output .= html_writer::tag('li', $item)."\n";
        }
        $output .= html_writer::end_tag($tag);
        return $output;
    }
214970
protected function _addHtmlAttributes(string $html, array $attribs): string {
        $dom = new DOMDocument();
        $fragment = $dom->createDocumentFragment();
        $fragment->appendXML($html);
        $dom->appendChild($fragment);
        foreach ($attribs as $attrib => $value) {
            $dom->firstChild->setAttribute($attrib, $value);
        }
        return $dom->saveXML($dom->firstChild);
    }
1029173
public static function array_insert(&$array, $item, $position) {
        if ($position == 0) {
            /* Prepend the item */
            array_unshift($array, $item);
        } else {
            if (count($array) == $position) {
                $array[] = $item;
            } else {
                array_splice($array, $position, 0, array($item));
            }
        }
    }
1159320
public function addTabs( $tabs = array() )
	{
		if( !is_array( $tabs ) )
			throw new InvalidArgumentException( 'Tabs must be given as array of labels and contents.' );
		foreach( $tabs as $label => $content )
			$this->addTab( $label, $content );
	}
1132620
public function copyFromArray(array &$array)
    {
        parent::copyFromArray($array);

        // action
        $this->setAction(
            AuthorizationIssueAction::valueOf(
                LanguageUtility::getFromArray('action', $array)));

        // responseContent
        $this->setResponseContent(
            LanguageUtility::getFromArray('responseContent', $array));
    }
646856
static function output($var)
	{
		if(!is_array($var)) self::warn('Error Debug!','Not is a array!');
		$attr['border'] = 1;
		$attr['style'] = 'font-size:14px';

		$table = new HTML_table($var, $attr);
		echo $table->html();
	}
890945
public function fromArray(array $array)
    {
        $this->removeAll();
        foreach ($array as $name => $values) {
            if (\is_array($values)) {
                foreach ($values as $value) {
                    $this->add($name, $value);
                }
            } else {
                $this->add($name, $values);
            }
        }
    }
1156496
public function copyToArray(array &$array)
    {
        parent::copyToArray($array);

        $array['action']            = LanguageUtility::toString($this->action);
        $array['clientId']          = $this->clientId;
        $array['subject']           = $this->subject;
        $array['scopes']            = $this->scopes;
        $array['claims']            = $this->claims;
        $array['token']             = $this->token;
        $array['responseContent']   = $this->responseContent;
        $array['properties']        = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
        $array['clientIdAlias']     = $this->clientIdAlias;
        $array['clientIdAliasUsed'] = $this->clientIdAliasUsed;
    }
110868
public static function push(&$array)
    {
        $params = func_get_arg();

        for ($i = 1; $i < static::count($params); $i++) {
            array_push($array, $params[$i]);
        }
    }
1362545
public function tr(array $attributes = []): void
    {
        $this->trArray[] = Tags::tr($this->tdArray, $attributes);
        $this->tdArray = [];
    }