Generates output by using flash messages

@return string
429470
protected function generateOutput() {
        $flashMessages = [];
        foreach ($this->messages as $messageItem) {
            /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */
            $flashMessages[] = GeneralUtility::makeInstance(FlashMessage::class, $messageItem[2], $messageItem[1], $messageItem[0]);
        }

            /** @var $resolver FlashMessageRendererResolver */
        $resolver = GeneralUtility::makeInstance(FlashMessageRendererResolver::class);
        $renderer = $resolver->resolve();
        return $renderer->render($flashMessages);
    }
799836
protected function output()
    {
        if (count($this->layers) == 0) {
            //throw new IncompleteStackException();
        }

        $stackClasses = 'fa-layers fa-fw';

        if (count($this->classes) > 0) {
            $stackClasses .= ' ' . implode(' ', $this->classes);
        }

        $layers = implode('', $this->layers);

        return sprintf(self::LAYERS_HTML, $stackClasses, $layers);
    }
847347
private function getOutputs() : string
    {
        ob_start();
        extract($this->data);
        require $this->file;
        $contents = ob_get_contents();
        ob_end_clean();

        return $contents;
    }
781488
public function generate()
    {
        return sprintf(
            '<input type="hidden" id="ctrl_%s" name="%s" value="%s" /><div%s>%s</div>',
            $this->strId,
            $this->strName,
            StringUtil::specialchars($this->label ?: $this->varValue),
            $this->style ? ' style="' . $this->style . '"' : '',
            $this->label
        );
    }
249588
public function renderMessages()
    {
        $return = '';
        $messages = $this->getForm()->getMessages();
        foreach ($messages as $type => $lines) {
            if ($type == "error") {
                $return .= ErrorsHelper::render($lines);
            } else {
                $return .= MessagesHelper::render($lines, $type);
            }
        }

        return $return;
    }
218674
public static function showFlash($flashes)
    {
        if (!$flashes) {
            return '';
        }

        $html = '<div class="message-wrap">';

        foreach ((array) $flashes as $type => $typeBag) {
            $html .= '<div class="alert alert-' . $type . ' alert-dismissible" role="alert">
                        <button type="button" class="close" data-dismiss="alert">
                          <span aria-hidden="true">&times;</span>
                          <span class="sr-only">Close</span>
                        </button>';

            foreach ((array) $typeBag as $msg) {
                $html .= '<p>' . $msg . '</p>';
            }

            $html .= '</div>';
        }

        $html .= '</div>';

        return $html;
    }
347052
protected function getFlashes()
    {
        $session = Yii::$app->session;
        $flashes = $session->getAllFlashes();
        $options = ArrayHelper::merge($this->layer->getDefaultOptions(), $this->options);
        $result = [];

        foreach ($flashes as $type => $data) {
            if (!in_array($type, $this->layer->types)) {
                continue;
            }
            $data = (array)$data;
            foreach ($data as $i => $message) {

                $this->layer->setType($type);
                $this->layer->setTitle();
                $this->layer->setMessage($message);

                $result[] = $this->layer->getNotification($options);
            }

            $session->removeFlash($type);
        }

        if ($this->isAjax) {
            return Html::tag('script', implode("\n", $result));
        }

        return $this->view->registerJs(implode("\n", $result));
    }
1079280
protected function renderXmlOutput()
    {
        $message = $this->translator()->translate('Method not allowed. Must be one of: {{ methods }}', [
            '{{ methods }}' => $this->getMethods()
        ], 'charcoal');

        return $this->renderTemplate('<root><message>'.$message.'</message></root>');
    }
549709
public function printMessage() {
		$messages = $this->session->get($this->sessionKey, []);
		$html = '';
		
		foreach ($messages as $message){
			$html .='<div id="message" class="' . $message['type'] . '"><p>' . $message['message'] . '</p></div>';
		}
		
		$this->clearSession();
		
		return $html;
	}
542009
public function flashMessage($message, $type = 'default', $comment=null, $icon=null, $width=50, $iconSize="lg", $timeout=5)
    {
        $id = $this->getParameterId('flash');
        $presenter = $this->getPresenter();
        if($presenter instanceof Presenter){
            $messages = $presenter->getFlashSession()->$id;
        } else {
            $messages = null;
        }

        $messages[] = $flash = (object) [
             'title' => $message,
             'type' => $type,
             'comment' => $comment,
             'icon' => $icon,
             'width' => $width,
             'iconSize' =>$iconSize,
             'timeout' => $timeout
         ];
        $this->getTemplate()->flashes = $messages;
        if($presenter instanceof Presenter){
            $presenter->getFlashSession()->$id = $messages;
        }
        return $flash;
    }
753098
protected function buildMessages(array $flashes, $type)
    {
        $messages = '';
        foreach ($flashes as $msg) {
            $messages .= $this->template->wrapMessage($msg);
        }

        return $this->template->wrapMessages($messages, $type);
    }
24956
public function getOutput() {
		// create stream handle for the output
		$handle = fopen('php://temp/maxmemory:'.(1*1024*1024), 'r+'); // 1MB

		fwrite($handle, '<?xml version="1.0"?>');
		
		// count subkeys. if there is more than one we have to generate an auto container
		// we have to take care of attributes
		$count = 0;
		foreach ($this->_content['content'] as $key => $item) {
			if ($key{0} != ':') $count++;
		}
		
		if ($count != 1) $this->_content['content'] = ['auto-container' => $this->_content['content']];
		fwrite($handle, $this -> _outputXML($this->_content['content']));
		return $handle;
	}
1129182
public function genMessage(){

		if( $this->currentFile && $this->currentFile['filename'] ){
			$this->message .= ' in '.basename($this->currentFile['filename']);
		}

		if( $this->index !== null ){
			$this->getInput();
			if( $this->input ){
				$line = self::getLineNumber();
				$this->message .= ' on line '.$line.', column '.self::getColumn();

				$lines = explode("\n",$this->input);

				$count = count($lines);
				$start_line = max(0, $line-3);
				$last_line = min($count, $start_line+6);
				$num_len = strlen($last_line);
				for( $i = $start_line; $i < $last_line; $i++ ){
					$this->message .= "\n".str_pad($i+1,$num_len,'0',STR_PAD_LEFT).'| '.$lines[$i];
				}
			}
		}

	}
529262
public function getOutput()
    {
        // Persistent opening
        $bufferKey = get_class($this).$this->binary.$this->movieFile;

        if (true === $this->persistent
            && array_key_exists($bufferKey, self::$persistentBuffer)
        ) {
            return self::$persistentBuffer[$bufferKey];
        }

        return $this->output;
    }
1090690
public function getFlashVarsAsString()
	{
		$params=array();
		foreach($this->flashVars as $k=>$v)
			$params[]=urlencode($k).'='.urlencode($v);
		return CJavaScript::quote(implode('&',$params));
	}
932455
public function as_text()
    {
        $output = '';
        $exts   = array();
        $idx    = 0;

        if (!empty($this->vars)) {
            if (in_array('variables', (array)$this->supported)) {
                $has_vars = true;
                array_push($exts, 'variables');
            }
            foreach ($this->vars as $var) {
                if (empty($has_vars)) {
                    // 'variables' extension not supported, put vars in comments
                    $output .= sprintf("# %s %s\n", $var['name'], $var['value']);
                }
                else {
                    $output .= 'set ';
                    foreach (array_diff(array_keys($var), array('name', 'value')) as $opt) {
                        $output .= ":$opt ";
                    }
                    $output .= self::escape_string($var['name']) . ' ' . self::escape_string($var['value']) . ";\n";
                }
            }
        }

        $imapflags = in_array('imap4flags', $this->supported) ? 'imap4flags' : 'imapflags';
        $notify    = in_array('enotify', $this->supported) ? 'enotify' : 'notify';

        // rules
        foreach ($this->content as $rule) {
            $script    = '';
            $tests     = array();
            $i         = 0;

            // header
            if (!empty($rule['name']) && strlen($rule['name'])) {
                $script .= '# rule:[' . $rule['name'] . "]\n";
            }

            // constraints expressions
            if (!empty($rule['tests'])) {
                foreach ($rule['tests'] as $test) {
                    $tests[$i] = '';
                    switch ($test['test']) {
                    case 'size':
                        $tests[$i] .= ($test['not'] ? 'not ' : '');
                        $tests[$i] .= 'size :' . ($test['type']=='under' ? 'under ' : 'over ') . $test['arg'];
                        break;

                    case 'true':
                        $tests[$i] .= ($test['not'] ? 'false' : 'true');
                        break;

                    case 'exists':
                        $tests[$i] .= ($test['not'] ? 'not ' : '');
                        $tests[$i] .= 'exists ' . self::escape_string($test['arg']);
                        break;

                    case 'header':
                    case 'string':
                        if ($test['test'] == 'string') {
                            array_push($exts, 'variables');
                        }

                        $tests[$i] .= ($test['not'] ? 'not ' : '');
                        $tests[$i] .= $test['test'];

                        $this->add_index($test, $tests[$i], $exts);
                        $this->add_operator($test, $tests[$i], $exts);

                        $tests[$i] .= ' ' . self::escape_string($test['arg1']);
                        $tests[$i] .= ' ' . self::escape_string($test['arg2']);
                        break;

                    case 'address':
                    case 'envelope':
                        if ($test['test'] == 'envelope') {
                            array_push($exts, 'envelope');
                        }

                        $tests[$i] .= ($test['not'] ? 'not ' : '');
                        $tests[$i] .= $test['test'];

                        if ($test['test'] != 'envelope') {
                            $this->add_index($test, $tests[$i], $exts);
                        }

                        // :all address-part is optional, skip it
                        if (!empty($test['part']) && $test['part'] != 'all') {
                            $tests[$i] .= ' :' . $test['part'];
                            if ($test['part'] == 'user' || $test['part'] == 'detail') {
                                array_push($exts, 'subaddress');
                            }
                        }

                        $this->add_operator($test, $tests[$i], $exts);

                        $tests[$i] .= ' ' . self::escape_string($test['arg1']);
                        $tests[$i] .= ' ' . self::escape_string($test['arg2']);
                        break;

                    case 'body':
                        array_push($exts, 'body');

                        $tests[$i] .= ($test['not'] ? 'not ' : '') . 'body';

                        if (!empty($test['part'])) {
                            $tests[$i] .= ' :' . $test['part'];

                            if (!empty($test['content']) && $test['part'] == 'content') {
                                $tests[$i] .= ' ' . self::escape_string($test['content']);
                            }
                        }

                        $this->add_operator($test, $tests[$i], $exts);

                        $tests[$i] .= ' ' . self::escape_string($test['arg']);
                        break;

                    case 'date':
                    case 'currentdate':
                        array_push($exts, 'date');

                        $tests[$i] .= ($test['not'] ? 'not ' : '') . $test['test'];

                        $this->add_index($test, $tests[$i], $exts);

                        if (!empty($test['originalzone']) && $test['test'] == 'date') {
                            $tests[$i] .= ' :originalzone';
                        }
                        else if (!empty($test['zone'])) {
                            $tests[$i] .= ' :zone ' . self::escape_string($test['zone']);
                        }

                        $this->add_operator($test, $tests[$i], $exts);

                        if ($test['test'] == 'date') {
                            $tests[$i] .= ' ' . self::escape_string($test['header']);
                        }

                        $tests[$i] .= ' ' . self::escape_string($test['part']);
                        $tests[$i] .= ' ' . self::escape_string($test['arg']);

                        break;

                    case 'duplicate':
                        array_push($exts, 'duplicate');

                        $tests[$i] .= ($test['not'] ? 'not ' : '') . $test['test'];

                        $tokens = array('handle', 'uniqueid', 'header');
                        foreach ($tokens as $token)
                            if ($test[$token] !== null && $test[$token] !== '') {
                                $tests[$i] .= " :$token " . self::escape_string($test[$token]);
                            }

                        if (!empty($test['seconds'])) {
                            $tests[$i] .= ' :seconds ' . intval($test['seconds']);
                        }

                        if (!empty($test['last'])) {
                            $tests[$i] .= ' :last';
                        }

                        break;
                    }

                    $i++;
                }
            }

            // disabled rule: if false #....
            if (!empty($tests)) {
                $script .= 'if ' . ($rule['disabled'] ? 'false # ' : '');

                if (count($tests) > 1) {
                    $tests_str = implode(', ', $tests);
                }
                else {
                    $tests_str = $tests[0];
                }

                if ($rule['join'] || count($tests) > 1) {
                    $script .= sprintf('%s (%s)', $rule['join'] ? 'allof' : 'anyof', $tests_str);
                }
                else {
                    $script .= $tests_str;
                }
                $script .= "\n{\n";
            }

            // action(s)
            if (!empty($rule['actions'])) {
                foreach ($rule['actions'] as $action) {
                    $action_script = '';

                    switch ($action['type']) {

                    case 'fileinto':
                        array_push($exts, 'fileinto');
                        $action_script .= 'fileinto ';
                        if ($action['copy']) {
                            $action_script .= ':copy ';
                            array_push($exts, 'copy');
                        }
                        $action_script .= self::escape_string($action['target']);
                        break;

                    case 'redirect':
                        $action_script .= 'redirect ';
                        if ($action['copy']) {
                            $action_script .= ':copy ';
                            array_push($exts, 'copy');
                        }
                        $action_script .= self::escape_string($action['target']);
                        break;

                    case 'reject':
                    case 'ereject':
                        array_push($exts, $action['type']);
                        $action_script .= $action['type'].' '
                            . self::escape_string($action['target']);
                        break;

                    case 'addflag':
                    case 'setflag':
                    case 'removeflag':
                        array_push($exts, $imapflags);
                        $action_script .= $action['type'].' '
                            . self::escape_string($action['target']);
                        break;

                    case 'keep':
                    case 'discard':
                    case 'stop':
                        $action_script .= $action['type'];
                        break;

                    case 'include':
                        array_push($exts, 'include');
                        $action_script .= 'include ';
                        foreach (array_diff(array_keys($action), array('target', 'type')) as $opt) {
                            $action_script .= ":$opt ";
                        }
                        $action_script .= self::escape_string($action['target']);
                        break;

                    case 'set':
                        array_push($exts, 'variables');
                        $action_script .= 'set ';
                        foreach (array_diff(array_keys($action), array('name', 'value', 'type')) as $opt) {
                            $action_script .= ":$opt ";
                        }
                        $action_script .= self::escape_string($action['name']) . ' ' . self::escape_string($action['value']);
                        break;

                    case 'notify':
                        array_push($exts, $notify);
                        $action_script .= 'notify';

                        $method = $action['method'];
                        unset($action['method']);
                        $action['options'] = (array) $action['options'];

                        // Here we support draft-martin-sieve-notify-01 used by Cyrus
                        if ($notify == 'notify') {
                            switch ($action['importance']) {
                                case 1: $action_script .= " :high"; break;
                                //case 2: $action_script .= " :normal"; break;
                                case 3: $action_script .= " :low"; break;
                            }

                            // Old-draft way: :method "mailto" :options "email@address"
                            if (!empty($method)) {
                                $parts = explode(':', $method, 2);
                                $action['method'] = $parts[0];
                                array_unshift($action['options'], $parts[1]);
                            }

                            unset($action['importance']);
                            unset($action['from']);
                            unset($method);
                        }

                        foreach (array('id', 'importance', 'method', 'options', 'from', 'message') as $n_tag) {
                            if (!empty($action[$n_tag])) {
                                $action_script .= " :$n_tag " . self::escape_string($action[$n_tag]);
                            }
                        }

                        if (!empty($method)) {
                            $action_script .= ' ' . self::escape_string($method);
                        }

                        break;

                    case 'vacation':
                        array_push($exts, 'vacation');
                        $action_script .= 'vacation';
                        if (isset($action['seconds'])) {
                            array_push($exts, 'vacation-seconds');
                            $action_script .= " :seconds " . intval($action['seconds']);
                        }
                        else if (!empty($action['days'])) {
                            $action_script .= " :days " . intval($action['days']);
                        }
                        if (!empty($action['addresses']))
                            $action_script .= " :addresses " . self::escape_string($action['addresses']);
                        if (!empty($action['subject']))
                            $action_script .= " :subject " . self::escape_string($action['subject']);
                        if (!empty($action['handle']))
                            $action_script .= " :handle " . self::escape_string($action['handle']);
                        if (!empty($action['from']))
                            $action_script .= " :from " . self::escape_string($action['from']);
                        if (!empty($action['mime']))
                            $action_script .= " :mime";
                        $action_script .= " " . self::escape_string($action['reason']);
                        break;
                    }

                    if ($action_script) {
                        $script .= !empty($tests) ? "\t" : '';
                        $script .= $action_script . ";\n";
                    }
                }
            }

            if ($script) {
                $output .= $script . (!empty($tests) ? "}\n" : '');
                $idx++;
            }
        }

        // requires
        if (!empty($exts)) {
            $exts = array_unique($exts);

            if (in_array('vacation-seconds', $exts) && ($key = array_search('vacation', $exts)) !== false) {
                unset($exts[$key]);
            }

            sort($exts); // for convenience use always the same order

            $output = 'require ["' . implode('","', $exts) . "\"];\n" . $output;
        }

        if (!empty($this->prefix)) {
            $output = $this->prefix . "\n\n" . $output;
        }

        return $output;
    }
1129055
public function outputMsgs() {
		$messages = $this->session->get('flashmsgs');
		$output = null;

		if ($messages) {
			foreach ($messages as $key => $message) {
				$output .= '<div class="' . $message['type'] . '"><p>' . $message['content'] . '</p></div>';
			}
		}

		return $output;
	}