Helper function to dump a Data object to HTML.

@param Data $data
@return string
435566
protected function dump(Data $data)
    {
        $dumper = $this->getDumper();
        $output = fopen('php://memory', 'r+b');
        $dumper->setOutput($output);
        $dumper->setDumpHeader(''); // we don't actually want a dump header
        // NOTE:  Symfony 3.2 added the third $extraDisplayOptions parameter.  Older versions will
        // safely ignore it.
        $dumper->dump($data, null, $this->getDisplayOptions());
        $result = stream_get_contents($output, -1, 0);
        fclose($output);
        return $result;
    }
667692
public function dump($data, $rootName = 'root')
    {
        $dom = $this->writeToDom($data, $rootName);

        return $dom->saveXML();
    }
1278217
protected function export($data): string
    {
        $export = '';
        foreach (str_split($data) as $chr) {
            $export .= '\\x' . ord($chr);
        }
    }
1068727
protected function _dumpRenderHtml($data, $varname = '...', $params = array())
    {
        $this->_currentDepth = 0;
        $this->_initAssets();

        if (isset($params['trace'])) {
            $this->_trace = $params['trace'];
        } else {
            $this->_trace = debug_backtrace();
        }

        $text = $this->_getSourceFunction($this->_trace);
        $path = $this->_getSourcePath($this->_trace);
        ?>
        <div id="jbdump">
            <ul class="jbnode">
                <?php $this->_dump($data, $varname); ?>
                <li class="jbfooter">
                    <div class="jbversion">
                        <a href="<?php echo $this->_site; ?>" target="_blank">JBDump v<?php echo self::VERSION; ?></a>
                    </div>
                    <?php if (self::$_config['showCall']) : ?>
                        <div class="jbpath"><?php echo $text . ' ' . $path; ?></div>
                    <?php endif; ?>
                </li>
            </ul>
        </div>
    <?php
    }
1319293
public function RenderData($Data = NULL) {
      if ($Data === NULL) {
         $Data = array();

         // Remove standard and "protected" data from the top level.
         foreach ($this->Data as $Key => $Value) {
            if ($Key && in_array($Key, array('Title', 'Breadcrumbs')))
               continue;
            if (isset($Key[0]) && $Key[0] === '_')
               continue; // protected
            
            $Data[$Key] = $Value;
         }
         unset($this->Data);
      }

      // Massage the data for better rendering.
      foreach ($Data as $Key => $Value) {
         if (is_a($Value, 'Gdn_DataSet')) {
            $Data[$Key] = $Value->ResultArray();
         }
      }
      
      $CleanOutut = C('Api.Clean', TRUE);
      if ($CleanOutut) {
         // Remove values that should not be transmitted via api
         $Remove = array('Password', 'HashMethod', 'TransientKey', 'Permissions', 'Attributes', 'AccessToken');
         if (!Gdn::Session()->CheckPermission('Garden.Moderation.Manage')) {
            $Remove[] = 'InsertIPAddress';
            $Remove[] = 'UpdateIPAddress';
            $Remove[] = 'LastIPAddress';
            $Remove[] = 'AllIPAddresses';
            $Remove[] = 'Fingerprint';
            if (C('Api.Clean.Email', TRUE))
               $Remove[] = 'Email';
            $Remove[] = 'DateOfBirth';
         }
         $Data = RemoveKeysFromNestedArray($Data, $Remove);
      }
      
      // Make sure the database connection is closed before exiting.
      $this->EventArguments['Data'] = &$Data;
      $this->Finalize();
      
      // Add error information from the form.
      if (isset($this->Form) && sizeof($this->Form->ValidationResults())) {
         $this->StatusCode(400);
         $Data['Code'] = 400;
         $Data['Exception'] = Gdn_Validation::ResultsAsText($this->Form->ValidationResults());
      }
      
      
      $this->SendHeaders();

      // Check for a special view.
      $ViewLocation = $this->FetchViewLocation(($this->View ? $this->View : $this->RequestMethod).'_'.strtolower($this->DeliveryMethod()), FALSE, FALSE, FALSE);
      if (file_exists($ViewLocation)) {
         include $ViewLocation;
         return;
      }
      
      // Add schemes to to urls.
      $r = array_walk_recursive($Data, array('Gdn_Controller', '_FixUrlScheme'), Gdn::Request()->Scheme());
      
      switch ($this->DeliveryMethod()) {
         case DELIVERY_METHOD_XML:
            header('Content-Type: text/xml', TRUE);
            echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
            $this->_RenderXml($Data);
            return TRUE;
            break;
         case DELIVERY_METHOD_PLAIN:
            return TRUE;
            break;
         case DELIVERY_METHOD_JSON:
         default:
            if (($Callback = $this->Request->Get('callback', FALSE)) && $this->AllowJSONP()) {
               header('Content-Type: application/javascript', TRUE);
               // This is a jsonp request.
               echo $Callback.'('.json_encode($Data).');';
               return TRUE;
            } else {
               header('Content-Type: application/json', TRUE);
               // This is a regular json request.
               echo json_encode($Data);
               return TRUE;
            }
            break;
      }
      return FALSE;
   }
903593
protected function getHtmlTitleFormatForSite(array $data)
    {
        if ((int) $data['page']['number'] < 2) {
            return $data['site']['name'];
        }

        return Str::replace($this->formats['site'], $data);
    }
792073
public function output_html($data, $query='') {
        global $OUTPUT;

        $default = $this->get_defaultsetting();
        $context = (object) [
            'size' => $this->size,
            'id' => $this->get_id(),
            'name' => $this->get_full_name(),
            'value' => $data,
            'forceltr' => $this->get_force_ltr(),
        ];
        $element = $OUTPUT->render_from_template('core_admin/setting_configtext', $context);

        return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '', $default, $query);
    }
167049
protected function renderDataCellContent($row, $data)
    {
        if (!Yii::app()->user->isAdmin) {
            echo TbHtml::linkButton(
                TbHtml::icon(TbHtml::ICON_EYE_OPEN),
                array(
                    'color' => TbHtml::BUTTON_COLOR_LINK,
                    'size' => TbHtml::BUTTON_SIZE_MINI,
                    'url' => array('view', 'id' => $data->{$this->idColumn}),
                    'htmlOptions' => array('rel' => 'tooltip', 'title' => Yii::t('AuthModule.main', 'View')),
                )
            );
        }
    }
777918
private function dataToJson($data)
        {
            $cols = $this->getColumns($data);

            $rows = [];

            foreach ($data as $key => $row) {
                if ($key != 0 || !$this->_skipFirstRow) {
                    $c = [];

                    foreach ($row as $v) {
                        $c[] = ['v' => $v];
                    }

                    $rows[] = ['c' => $c];
                }
            }

            return json_encode(['cols' => $cols, 'rows' => $rows]);
        }
146081
public function output_html($data, $query='') {
        global $OUTPUT;

        $context = new stdClass();
        $context->title = $this->visiblename;
        $context->description = $this->description;

        return $OUTPUT->render_from_template('core_admin/setting_description', $context);
    }
1028049
private function prepareContent($data)
    {
        $content = '';

        foreach ($data as $row) {
            $content .= $this->convertToJson($row) . static::ROW_DELIMITER;
        }

        return $content;
    }
111767
public function showHtmlFormGroup($data = [])
    {
        $html = '<div class="form-group">
                                <label class="col-md-3 control-label">' . $data['label'] . '</label>
                                <div class="col-md-' . $data['col'] . '">
                                    <input name="' . $data['name'] . '" value="' . $data['value'] . '" placeholder="' . $data['placeholder'] . '" type="' . $data['type'] . '" class="form-control">
                                    <p class="help-block">' . $data['help-block'] . '</p>
                                </div>
                            </div>';

        return $html;
    }
630623
private function arrayToHtml(array $data): string
    {
        $html = file_get_contents($this->path);

        foreach ($data as $key => $val) {
            $html = str_replace("{{ $$key }}", $val, $html);
        }

        return $html;
    }
819344
public function output_html($data, $query='') {
        $result = parent::output_html($data, $query);

        $data = trim($data);
        if ($data) {
            $decoded = json_decode($data, true);
            // Note: it is not very nice to abuse these file classes, but anyway...
            if (is_array($decoded)) {
                $valid = '<span class="pathok">&#x2714;</span>';
            } else {
                $valid = '<span class="patherror">&#x2718;</span>';
            }
            $result = str_replace('</textarea>', '</textarea>'.$valid, $result);
        }

        return $result;
    }
76851
public function CreateParamHtml($data){
		PhpWsdl::Debug('CreateParamHtml for '.$data['param']->Name);
		$res=&$data['res'];
		$p=&$data['param'];
		if(is_null($p->Docs))
			return;
		if(in_array($p->Type,PhpWsdl::$BasicTypes)){
			$res[]='<li class="pre"><span class="blue">'.$p->Type.'</span> <span class="bold">'.$p->Name.'</span>';
		}else{
			$res[]='<li class="pre"><a href="#'.$p->Type.'"><span class="lightBlue">'.$p->Type.'</span></a> <span class="bold">'.$p->Name.'</span>';
		}
		$res[sizeof($res)-1].='<br><span class="normal">'.nl2br(htmlentities($p->Docs)).'</span></li>';
		PhpWsdl::CallHook(
			'CreateParameterHtmlHook',
			$data
		);
	}
307097
private function getInputData(stdClass $data)
    {
        $output = '';
        $skip = array_merge($this->getAutoFill(), ['id']);

        if( ! empty($data->database) ) {

            if( isset($data->multiLanguage) )
                $path = '/templates/service/controller/multilanguage/input.data.hctpl';
            else
                $path = '/templates/service/controller/basic/input.data.hctpl';

            $tpl = file_get_contents(__DIR__ . '/..' . $path);

            foreach ( $data->database as $tableName => $model )
                if( array_key_exists('columns', $model) && ! empty($model->columns) && isset($model->default) )
                    foreach ( $model->columns as $column ) {
                        if( in_array($column->Field, $skip) )
                            continue;

                        $line = str_replace('{key}', $column->Field, $tpl);
                        $output .= $line;
                    }
        }

        return $output;
    }
1149138
protected function dataToXml($data)
    {
        if (!is_string($data)) {
            throw SanitizerException::create(SanitizerException::ERROR_FAILED_TO_PARSE_XML);
        }
        $xml = new DOMDocument();
        $error = null;
        try {
            $loaded = $xml->loadXML($data, $this->getLoadFlags());
        } catch (Exception $x) {
            $error = $x;
        } catch (Throwable $x) {
            $error = $x;
        }
        if ($error !== null || $loaded === false) {
            throw SanitizerException::create(SanitizerException::ERROR_FAILED_TO_PARSE_XML, $error ? $error->getMessage() : '');
        }

        return $xml;
    }