Output the headers (php).

@param bool $replace tells to replace eventual headers
556558
public function outputHeaders($replace = true)
    {
        $lines = $this->getHeaderLines();
        foreach ($lines as $line) {
            header($line, $replace);
        }
    }
312808
protected function replaceInFile($needle, $replace, $filename)
    {
        if ($filename == '.' || $filename == '..') return;
        file_put_contents( 
            $filename, 
            preg_replace(
                '/' . $needle . '/',
                $replace,
                file_get_contents($filename)
            ) 
        );
    }
334671
public function output_headers($headers) {
        $this->columns = $headers;
        if (method_exists($this->dataformat, 'write_header')) {
            error_log('The function write_header() does not support multiple sheets. In order to support multiple sheets you ' .
                'must implement start_output() and start_sheet() and remove write_header() in your dataformat.');
            $this->dataformat->write_header($headers);
        } else {
            $this->dataformat->start_sheet($headers);
        }
    }
886661
public static function replaceWith($replacement): callable
    {
        return function (&$val) use ($replacement) : bool{
            if (empty($val)) {
                $val = $replacement;
            }

            return true;
        };
    }
317794
public function set($key, $values, $replace = true)
    {
        parent::set($key, $values, $replace);
        $this->updateRequest();
    }
1297576
public function outputWithHeaders($filename='worksheet')
    {
        $filename = preg_replace('/[^aA-zZ0-9\_\-]/', '', $filename);

        header("Content-Type: application/msexcel; charset=" . $this->encoding);
        header("Content-Disposition: inline; filename=\"" . $filename . ".xlsx\"");
        echo $this->__toString();
    }
848349
public function screamAt($levels, $replace = false)
    {
        $prev = $this->screamedErrors;
        $this->screamedErrors = (int) $levels;
        if (!$replace) {
            $this->screamedErrors |= $prev;
        }

        return $prev;
    }
694403
public function render(array $replacements)
    {
        if (file_exists($this->target)) {
            throw new RuntimeException('Cannot generate file. Target ' . $this->target . ' already exists.');
        }

        $contents = file_get_contents($this->source);

        // Standard replacements
        collect($replacements)->each(function (string $replacement, string $tag) use (&$contents) {
            $contents = str_replace($tag, $replacement, $contents);
        });

        $path = pathinfo($this->target, PATHINFO_DIRNAME);

        if (! file_exists($path)) {
            mkdir($path, 0776, true);
        }

        file_put_contents($this->target, $contents);
    }
93897
protected function log(bool $success) : void
    {
        if ($success) {
            $this->stdout('Success!', Console::FG_GREEN, Console::BOLD);
        } else {
            $this->stderr('Error!', Console::FG_RED, Console::BOLD);
        }
        $this->stdout(PHP_EOL);
    }
459440
function renderHeader(&$header)
    {
        $name = $header->getName();
        $id = empty($name) ? '' : ' id="' . $name . '"';
        if (is_null($header->_text)) {
            $header_html = '';
        }
        elseif (!empty($name) && isset($this->_templates[$name])) {
            $header_html = str_replace('{header}', $header->toHtml(), $this->_templates[$name]);
        } else {
            $header_html = str_replace('{header}', $header->toHtml(), $this->_headerTemplate);
        }
        if ($this->_fieldsetsOpen > 0) {
            $this->_html .= $this->_closeFieldsetTemplate;
            $this->_fieldsetsOpen--;
        }
        $openFieldsetTemplate = str_replace('{id}', $id, $this->_openFieldsetTemplate);
        $this->_html .= $openFieldsetTemplate . $header_html;
        $this->_fieldsetsOpen++;
    }
372257
static function OutputHeaders($realm = "Login Required", $terminate = true)
	{
		header("WWW-Authenticate: Basic realm=\"".$realm."\"");
		header("Status: 401 Unauthorized");
		header("HTTP-Status: 401 Unauthorized");
		if ($terminate) die();
	}
1252035
public function output($remove = true)
    {
        $context = $this->_context;

        foreach ($context->messages as $message) {
            echo $message;
        }

        if ($remove) {
            $context->messages = [];
        }
    }
449291
public function debugQuery($replaced = true) {
        $q = $this->queryString;

        if (!$replaced) {
            return $q;
        }
        else {
            if (count($this->_debugBindValues) > 0) {
                return preg_replace_callback('/:([0-9a-z_]+)/i', [$this, '_debugReplaceBindValue'], $q);
            }
            else {
                return $q;
            }
        }
    }
309200
public function traceAt($levels, $replace = false)
    {
        $prev = $this->tracedErrors;
        $this->tracedErrors = (int) $levels;
        if (!$replace) {
            $this->tracedErrors |= $prev;
        }

        return $prev;
    }
773112
protected function replaceIn($path, $search, $replace)
    {
        if ($this->output->isVerbose()) {
            $this->line("{$path} ...");
        }

        $this->filesystem->put($path, str_replace($search, $replace, $this->filesystem->get($path)));
    }
1026643
public function save($replace = true, $prepare = true) {
        $this->add(new \bootbuilder\Controls\Hidden("bootbuilder-form", $this->id));
        
        if($replace) {
            \bootbuilder\Validation\Validator::clean();
        }
        
        \bootbuilder\Validation\Validator::save($this, $this->id, $prepare);
    }
1332550
protected function outputHeaders()
    {
        $headersSent = headers_sent($file, $line);
        if (!$headersSent) {
            $method = sprintf(
                "%s %d %s",
                $_SERVER['SERVER_PROTOCOL'],
                $this->getStatusCode(),
                $this->getStatusDescription()
            );
            header($method);
            foreach ($this->getHeaders() as $header => $value) {
                header("{$header}: {$value}", true, $this->getStatusCode());
            }
        } elseif ($this->getStatusCode() >= 300) {
            // It's critical that these status codes are sent; we need to report a failure if not.
            user_error(
                sprintf(
                    "Couldn't set response type to %d because of output on line %s of %s",
                    $this->getStatusCode(),
                    $line,
                    $file
                ),
                E_USER_WARNING
            );
        }
    }