Output scripts.

@since 1.1.5

@param string $place  → header|footer
@param string $output → output for scripts

@return string|false → output or false
431461
public static function outputScripts($place, $output = '')
    {
        self::lookIfProcessFiles('script', $place);

        $template = self::$templates['script'];
        $scripts = self::$data['script'][$place];

        foreach ($scripts as $value) {
            $output .= sprintf(
                $template,
                $value['attr'],
                $value['url']
            );
        }

        self::$data['script'][$place] = [];

        return ! empty($output) ? $output : false;
    }
355294
public function sendOutput(String $output, String $colour='white', String $backgroundColor='black')
	{
		fwrite(STDOUT, $this->getText($output, $colour, $backgroundColor));
	}
933448
public function processMailOutput($output, Kwc_Mail_Recipient_Interface $recipient = null)
    {
        $placeholders = Kwf_Component_Data_Root::getInstance()
            ->getComponentById($this->_componentId)
            ->getComponent()->getPlaceholders($recipient);
        foreach ($placeholders as $p=>$v) {
            $output = str_replace("%$p%", $v, $output);
        }
        return $output;
    }
1242370
protected function processOutput(array $output = [])
    {
        $data = null;
        if (is_array($output)) {
            foreach ($output as $item) {
                if (is_string($item)) {
                    if ($this->checkOutputStringForData($item)) {
                        $data = $this->transformOutputStringToData($item);
                    } else {
                        echo $item . PHP_EOL;
                    }
                }
            }
        } elseif (is_string($output)) {
            if ($this->checkOutputStringForData($output)) {
                $data = $this->transformOutputStringToData($output);
            } else {
                echo $output . PHP_EOL;
            }
        }

        return $data;
    }
1152460
public function sendOutputTo($location, $append = false)
    {
        $this->output = $location;

        $this->shouldAppendOutput = $append;

        return $this;
    }
765723
public function getLocation($output = '')
    {
        $attachments = $this->getAttachments();

        $location = new \stdClass();

        if (!empty($attachments) && isset($attachments[0]['type']) && $attachments[0]['type'] === 'location') {
            $location = $attachments[0]['payload']->coordinates;
        }

        if (!empty($output)) {
            return $location->$output;
        }

        return $location;
    }
41618
private function makeReplace($output){
		$replaced = $output;

		foreach($this->_direct_replace as $key => $val){
			$needle = '{' . strtoupper(trim($key, '{} ')) . '}';

			$replaced = str_replace($needle, $val, $replaced);
		}

		return $replaced;
	}
290108
private function writeToOutputNow($output)
    {
        if ($this->sendHttpCode() && \Whoops\Util\Misc::canSendHeaders()) {
            $httpCode   = $this->sendHttpCode();

            if (function_exists('http_response_code')) {
                http_response_code($httpCode);
            } else {
                // http_response_code is added in 5.4.
                // For compatibility with 5.3 we use the third argument in header call
                // First argument must be a real header.
                // If it is empty, PHP will ignore the third argument.
                // If it is invalid, such as a single space, Apache will handle it well,
                // but the PHP development server will hang.
                // Setting a full status line would require us to hardcode
                // string values for all different status code, and detect the protocol.
                // which is an extra error-prone complexity.
                header('X-Ignore-This: 1', true, $httpCode);
            }
        }

        echo $output;

        return $this;
    }
227283
public function prepareOutput($output, $strict = false)
    {
        if ($strict && version_compare(PHP_VERSION, '7') < 1) {
            throw new RuntimeException('Strict mode requires PHP 7 or greater.');
        }

        $dir = dirname($output);

        if (!is_dir($dir) && !mkdir($dir, 0777, true)) {
            throw new RuntimeException("Unable to create directory $dir.");
        }

        $handle = fopen($output, 'w');

        if (!$handle) {
            throw new RuntimeException("Unable to open $output for writing.");
        }

        if ($strict) {
            fwrite($handle, "<?php declare(strict_types=1);\n");
        } else {
            fwrite($handle, "<?php\n");
        }

        return $handle;
    }
1193818
public function output($response)
    {
        //argument 1 should be an array or ArrayAccess
        Argument::i()->test(1, 'array', 'ArrayAccess');
        
        $code = $response['code'];
        $headers = $response['headers'];
        $body = $response['body'];
        
        if (is_int($code)) {
            http_response_code($code);
        }
        
        if (!isset($headers['Content-Type']) && !isset($headers['content-type'])) {
            $headers['Content-Type'] = 'text/html; charset=utf-8';
        }
        
        if (!$body) {
            $body = '';
        }
        
        //if it's not scalar
        if (!is_scalar($body)) {
            $body = json_encode($body, JSON_PRETTY_PRINT);
        }
        
        foreach ($headers as $name => $value) {
            if (!$value) {
                header($name);
                continue;
            }
            
            header($name.':'.$value);
        }

        $check = new \StdClass();
        $check->stop = false;

        $this->trigger('server-output', $response, $body, $check);
        
        if (!$check->stop) {
            echo (string) $body;
            $this->successful = true;
        }
        
        return $this;
    }
238880
public function registr($place, $controller)
    {
        if (preg_match('/^[a-z0-9]+:[a-z0-9]+:[_a-z0-9]+$/i', $controller)) {
            if (!isset($this->widgets[$place])) {
                $this->widgets[$place][] = $controller;
            } elseif (!in_array($controller, $this->widgets[$place])) {
                $this->widgets[$place][] = $controller;
            }

            return true;
        }

        return false;
    }
1357674
protected function parseOutput($compiler, $output)
    {
        $jsPhpize = $this->getJsPhpizeEngine($compiler);
        $output = preg_replace(
            '/\{\s*\?><\?(?:php)?\s*\}/',
            '{}',
            $output
        );
        $output = preg_replace(
            '/\}\s*\?><\?(?:php)?\s*(' .
            'else(if)?|for|while|switch|function' .
            ')(?![a-zA-Z0-9_])/',
            '} $1',
            $output
        );

        $dependencies = $jsPhpize->compileDependencies();
        if ($dependencies !== '') {
            $output = $compiler->getFormatter()->handleCode($dependencies) . $output;
        }

        $jsPhpize->flushDependencies();

        return $output;
    }
15079
public function processOutput($output)
	{
		if($this->hasEventHandler('onProcessOutput'))
		{
			$event=new COutputEvent($this,$output);
			$this->onProcessOutput($event);
			if(!$event->handled)
				echo $output;
		}
		else
			echo $output;
	}
631724
public function export_for_template(renderer_base $output) {
        global $SITE;

        $sitename = format_string($SITE->fullname);
        $formhtml = $this->form->render();
        $error = $this->errormessage;

        $context = [
            'sitename' => $sitename,
            'formhtml' => $formhtml,
            'error'    => $error
        ];

        return $context;
    }
359985
public function assertCommandResultWithOutput($result, PyStringNode $output) {
        $this->assertCommandResult($result);
        $this->assertCommandOutputMatches($output);
    }
1373230
private function make_output( $assets, $type ) {

		$output = '';
	
		$output .= '<pre>' . $type . ' trovati in coda'."\r\n";
		foreach ( $assets->queue as $asset ) {

			if ( ! isset( $assets->registered[ $asset ] ) ) {
				continue;
			}

			$output .= "\r\nHandle: <strong>" . $asset . "</strong>\n";
			$output .= "<i class='small'>URL: " . $assets->registered[ $asset ]->src . "</i class='small'>\r\n";
			$deps = $assets->registered[ $asset ]->deps;
			if ( $deps ) {
				$output .= 'Dipende da >>>>>>> ';
				// $output .= print_r( $deps, true );
				foreach ( $deps as $dep ) {
					$output .= '<strong>' . $dep . '</strong>, ';
				}
				$output .= "\r\n";
			} else {
				$output .= "Non dipende da nessuno\r\n";
			}
		}
		$output .= "\r\n</pre>";

		return $output;
	}
951303
protected function serializeOutput(DOMElement $output)
	{
		$context = $output->getAttribute('escape');

		$php = '$this->out.=';
		if ($output->getAttribute('type') === 'xpath')
		{
			$php .= $this->escapePHPOutput($this->convertXPath($output->textContent), $context);
		}
		else
		{
			$php .= var_export($this->escapeLiteral($output->textContent, $context), true);
		}
		$php .= ';';

		return $php;
	}